feat(dozzle): Add lightweight Docker log viewer
Add Dozzle for simple, real-time Docker container log viewing. Features: - Real-time log streaming from all containers - Search and filter capabilities - Multi-container side-by-side view - Container resource statistics (CPU, memory) - No database required (reads directly from Docker) - Minimal footprint (~4MB image) Configuration: - Restricted to local network only (local-only middleware) - Auto-discovery of all running containers - Dark/light theme support Includes quickstart guide and comprehensive documentation.
This commit is contained in:
parent
27e4f5267d
commit
36e580f180
4 changed files with 422 additions and 0 deletions
2
compose/services/dozzle/.gitignore
vendored
Normal file
2
compose/services/dozzle/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Environment files
|
||||
.env
|
||||
133
compose/services/dozzle/QUICKSTART.md
Normal file
133
compose/services/dozzle/QUICKSTART.md
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
# Dozzle - Quick Start
|
||||
|
||||
## Access Now
|
||||
|
||||
**Open:** https://logs-docker.fig.systems
|
||||
|
||||
## What You'll See
|
||||
|
||||
- List of all running Docker containers
|
||||
- Click any container to see its logs
|
||||
- Real-time streaming (updates automatically)
|
||||
- Search box at top to filter logs
|
||||
|
||||
## Common Tasks
|
||||
|
||||
### View logs from a specific container
|
||||
1. Click the container name from the list
|
||||
2. Logs appear instantly
|
||||
|
||||
### Search for errors
|
||||
1. Open any container's logs
|
||||
2. Type `error` in the search box at top
|
||||
3. Only matching lines show
|
||||
|
||||
### View multiple containers at once
|
||||
1. Open first container
|
||||
2. Click the **"+"** button in the header
|
||||
3. Select another container
|
||||
4. View side-by-side
|
||||
|
||||
### Download logs
|
||||
1. Open container logs
|
||||
2. Click **"Download"** button (top right)
|
||||
3. Saves visible logs as .txt file
|
||||
|
||||
### View older logs
|
||||
- Scroll up in the log view
|
||||
- Note: Only shows what Docker has stored (default: all logs)
|
||||
|
||||
### Pause live streaming
|
||||
- Click the **pause button** (⏸️) to stop auto-scrolling
|
||||
- Useful when examining specific log entries
|
||||
- Click **play** (▶️) to resume
|
||||
|
||||
## Settings
|
||||
|
||||
Click the **gear icon** (⚙️) to:
|
||||
- Change theme (dark/light)
|
||||
- Adjust font size
|
||||
- Change date/time format
|
||||
- Toggle compact mode
|
||||
|
||||
## Limitations
|
||||
|
||||
**Dozzle shows logs Docker currently has.** For logs older than a week:
|
||||
|
||||
1. **Check Docker's log retention:**
|
||||
```bash
|
||||
docker inspect <container-name> | grep -A 5 "LogConfig"
|
||||
```
|
||||
|
||||
2. **If logs are rotating too quickly**, configure Docker log rotation:
|
||||
|
||||
Edit `/etc/docker/daemon.json`:
|
||||
```json
|
||||
{
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "50m",
|
||||
"max-file": "5"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This keeps ~250MB of logs per container.
|
||||
|
||||
3. **Restart Docker:**
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
4. **Recreate containers** (they inherit new log settings)
|
||||
|
||||
## vs Loki/Grafana
|
||||
|
||||
| Feature | Dozzle | Loki/Grafana |
|
||||
|---------|--------|--------------|
|
||||
| Setup | ✅ Simple (1 container) | ⚠️ Complex (3 containers + config) |
|
||||
| Real-time logs | ✅ Excellent | ✅ Good |
|
||||
| Search | ✅ Simple text search | ✅ Advanced LogQL queries |
|
||||
| History | ⚠️ Limited to Docker's retention | ✅ Configurable retention |
|
||||
| Multi-server | ⚠️ Requires setup | ✅ Built-in |
|
||||
| Log aggregation | ❌ No | ✅ Yes |
|
||||
| Alerts | ❌ No | ✅ Yes |
|
||||
| Resource usage | ✅ Minimal (~10MB) | ⚠️ Higher (~200MB+) |
|
||||
|
||||
**Recommendation:** Use both!
|
||||
- **Dozzle** for quick log checks and real-time monitoring
|
||||
- **Loki** for historical analysis and complex queries
|
||||
|
||||
## Tips
|
||||
|
||||
1. **Bookmark the URL** - Quick access to your logs
|
||||
2. **Use keyboard shortcuts:**
|
||||
- `/` - Focus search
|
||||
- `Space` - Pause/resume
|
||||
- `Esc` - Clear search
|
||||
3. **Multi-tab viewing** - Open different containers in browser tabs
|
||||
4. **Container stats** - Click "Stats" tab to see CPU/memory usage
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**No containers showing?**
|
||||
```bash
|
||||
docker logs dozzle
|
||||
```
|
||||
|
||||
**Can't access the web UI?**
|
||||
```bash
|
||||
# Check if Dozzle is running
|
||||
docker ps | grep dozzle
|
||||
|
||||
# Check Traefik routing
|
||||
docker logs traefik | grep dozzle
|
||||
```
|
||||
|
||||
**Logs are truncated?**
|
||||
- Docker may be rotating logs too aggressively
|
||||
- See "Limitations" section above to increase retention
|
||||
|
||||
---
|
||||
|
||||
**Need more help?** Check the full README.md in this directory.
|
||||
232
compose/services/dozzle/README.md
Normal file
232
compose/services/dozzle/README.md
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
# Dozzle - Simple Docker Log Viewer
|
||||
|
||||
A lightweight, web-based Docker log viewer with real-time streaming.
|
||||
|
||||
## Features
|
||||
|
||||
- ✅ **Real-time log streaming** - See logs as they happen
|
||||
- ✅ **Search and filter** - Find specific log entries instantly
|
||||
- ✅ **Multi-container view** - View multiple containers side-by-side
|
||||
- ✅ **No database required** - Reads directly from Docker
|
||||
- ✅ **Tiny footprint** - Only ~4MB image size
|
||||
- ✅ **Container stats** - CPU, memory usage per container
|
||||
- ✅ **Dark/Light themes** - Easy on the eyes
|
||||
|
||||
## Access
|
||||
|
||||
**URL:** https://logs-docker.fig.systems
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Deploy
|
||||
|
||||
```bash
|
||||
cd /home/eduardo_figueroa/homelab/compose/services/dozzle
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### View Logs
|
||||
|
||||
1. Open https://logs-docker.fig.systems
|
||||
2. Click on any container to view logs
|
||||
3. Use search box to filter logs
|
||||
4. Click "Settings" to change theme, tail size, etc.
|
||||
|
||||
## Features Guide
|
||||
|
||||
### Real-Time Streaming
|
||||
|
||||
- Logs update automatically as new entries arrive
|
||||
- Pause/resume streaming with the pause button
|
||||
- Auto-scrolls to latest logs (disable to scroll through history)
|
||||
|
||||
### Search & Filter
|
||||
|
||||
**Search box features:**
|
||||
- Simple text search: `error`
|
||||
- Case-sensitive toggle
|
||||
- Regex support: `HTTP [45]\d{2}`
|
||||
- Multi-word: `error database connection`
|
||||
|
||||
**Quick filters:**
|
||||
- Click container name to filter to that container
|
||||
- Use dropdown to switch between containers
|
||||
- Multi-container view: Click "+" to add more containers
|
||||
|
||||
### Container Stats
|
||||
|
||||
Click "Stats" tab to view:
|
||||
- CPU usage %
|
||||
- Memory usage (MB)
|
||||
- Network I/O
|
||||
- Block I/O
|
||||
|
||||
### Multi-Container View
|
||||
|
||||
View logs from multiple containers simultaneously:
|
||||
1. Click container to open logs
|
||||
2. Click "+" button in header
|
||||
3. Select another container
|
||||
4. View side-by-side or stacked
|
||||
|
||||
### Download Logs
|
||||
|
||||
- Click "Download" button (top right)
|
||||
- Downloads current view as .txt file
|
||||
- Includes visible log lines only
|
||||
|
||||
### Settings
|
||||
|
||||
Click gear icon to configure:
|
||||
- **Theme**: Dark or light mode
|
||||
- **Tail size**: Number of lines to load (default: 300)
|
||||
- **Datetime format**: Customize timestamp display
|
||||
- **Font size**: Adjust log text size
|
||||
|
||||
## Log Retention
|
||||
|
||||
**Note:** Dozzle shows logs from Docker's log driver. By default, Docker keeps logs indefinitely, which can consume disk space.
|
||||
|
||||
### Check Current Log Size
|
||||
|
||||
```bash
|
||||
# See total size of all container logs
|
||||
sudo du -sh /var/lib/docker/containers/
|
||||
|
||||
# Size per container
|
||||
sudo du -sh /var/lib/docker/containers/*
|
||||
```
|
||||
|
||||
### Configure Log Rotation (Recommended)
|
||||
|
||||
Create/edit `/etc/docker/daemon.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "10m",
|
||||
"max-file": "3"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This keeps:
|
||||
- Max 10MB per log file
|
||||
- Max 3 files per container
|
||||
- ~30MB total per container
|
||||
|
||||
Then restart Docker:
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
**Note:** Existing containers need to be recreated to use new settings.
|
||||
|
||||
## Limitations
|
||||
|
||||
### Log History
|
||||
|
||||
Dozzle shows what Docker has stored. To view logs from the last week:
|
||||
|
||||
1. **Ensure Docker is keeping enough logs** (see log rotation above)
|
||||
2. **Increase tail size** in Dozzle settings (default: 300 lines)
|
||||
3. **Scroll up** in log view to see older entries
|
||||
|
||||
If you need longer-term log storage and analysis, continue using Loki/Grafana for historical queries.
|
||||
|
||||
### vs Loki/Grafana
|
||||
|
||||
**Use Dozzle for:**
|
||||
- Quick log checks
|
||||
- Real-time monitoring
|
||||
- Simple searching
|
||||
- Single-server setups
|
||||
|
||||
**Use Loki/Grafana for:**
|
||||
- Long-term log retention
|
||||
- Complex queries across time ranges
|
||||
- Multi-server log aggregation
|
||||
- Alerts based on log patterns
|
||||
- Historical analysis
|
||||
|
||||
## Authentication
|
||||
|
||||
To enable basic auth (recommended for external access):
|
||||
|
||||
1. Edit `.env`:
|
||||
```bash
|
||||
DOZZLE_USERNAME=admin
|
||||
DOZZLE_PASSWORD=your-secure-password
|
||||
```
|
||||
|
||||
2. Uncomment auth lines in `compose.yaml`:
|
||||
```yaml
|
||||
environment:
|
||||
DOZZLE_USERNAME: ${DOZZLE_USERNAME}
|
||||
DOZZLE_PASSWORD: ${DOZZLE_PASSWORD}
|
||||
```
|
||||
|
||||
3. Restart:
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Multi-Host Setup
|
||||
|
||||
To view logs from multiple Docker hosts:
|
||||
|
||||
1. Configure remote Docker hosts to expose API (carefully!)
|
||||
2. Add to compose.yaml:
|
||||
```yaml
|
||||
environment:
|
||||
DOZZLE_REMOTE_HOST: tcp://remote-host:2375|Remote Server Name
|
||||
```
|
||||
|
||||
Or add via UI: Settings → Hosts → Add host
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### No containers showing
|
||||
|
||||
**Check Docker socket access:**
|
||||
```bash
|
||||
docker logs dozzle
|
||||
```
|
||||
|
||||
Should see: "Dozzle version X.X.X"
|
||||
|
||||
### Slow performance
|
||||
|
||||
**Reduce tail size:** Settings → Tail size → 100
|
||||
|
||||
### Old logs not showing
|
||||
|
||||
**Check Docker log retention:**
|
||||
```bash
|
||||
docker inspect <container> | grep -A 10 "LogConfig"
|
||||
```
|
||||
|
||||
If `max-size` is too small, increase it in `/etc/docker/daemon.json`
|
||||
|
||||
## Keyboard Shortcuts
|
||||
|
||||
- `/` - Focus search box
|
||||
- `Esc` - Clear search
|
||||
- `Space` - Pause/resume streaming
|
||||
- `↑/↓` - Scroll logs
|
||||
- `Ctrl+F` - Browser find
|
||||
|
||||
## Tips
|
||||
|
||||
1. **Bookmark frequently-checked containers** - Use browser bookmarks for direct URLs
|
||||
2. **Use browser tabs** - Open multiple containers in separate tabs
|
||||
3. **Combine with Loki** - Use Dozzle for live monitoring, Loki for historical queries
|
||||
4. **Set up log rotation** - Prevent disk space issues
|
||||
5. **Enable auth** - If exposed to internet
|
||||
|
||||
## Links
|
||||
|
||||
- **Documentation:** https://dozzle.dev/
|
||||
- **GitHub:** https://github.com/amir20/dozzle
|
||||
- **Docker Hub:** https://hub.docker.com/r/amir20/dozzle
|
||||
55
compose/services/dozzle/compose.yaml
Normal file
55
compose/services/dozzle/compose.yaml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# Dozzle - Simple Docker Log Viewer
|
||||
# Docs: https://dozzle.dev/
|
||||
# GitHub: https://github.com/amir20/dozzle
|
||||
|
||||
services:
|
||||
dozzle:
|
||||
container_name: dozzle
|
||||
image: amir20/dozzle:latest
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
environment:
|
||||
# UI Settings
|
||||
DOZZLE_LEVEL: info
|
||||
|
||||
# Enable authentication (optional)
|
||||
# DOZZLE_USERNAME: admin
|
||||
# DOZZLE_PASSWORD: your-password-here
|
||||
|
||||
# Multi-host support (optional)
|
||||
# DOZZLE_REMOTE_HOST: tcp://remote-docker:2375|Remote Server
|
||||
|
||||
# Filters
|
||||
DOZZLE_FILTER: status=running
|
||||
|
||||
# Base path if behind reverse proxy
|
||||
# DOZZLE_BASE: /dozzle
|
||||
|
||||
networks:
|
||||
- homelab
|
||||
|
||||
labels:
|
||||
# Traefik
|
||||
traefik.enable: true
|
||||
traefik.docker.network: homelab
|
||||
|
||||
# Web UI
|
||||
traefik.http.routers.dozzle.rule: Host(`logs-docker.fig.systems`)
|
||||
traefik.http.routers.dozzle.entrypoints: websecure
|
||||
traefik.http.routers.dozzle.tls.certresolver: letsencrypt
|
||||
traefik.http.services.dozzle.loadbalancer.server.port: 8080
|
||||
|
||||
# Local LAN only - IP allowlist
|
||||
traefik.http.routers.dozzle.middlewares: local-only
|
||||
|
||||
# Homarr Discovery
|
||||
homarr.name: Dozzle (Docker Logs)
|
||||
homarr.group: Monitoring
|
||||
homarr.icon: mdi:docker
|
||||
|
||||
networks:
|
||||
homelab:
|
||||
external: true
|
||||
Loading…
Reference in a new issue