39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
# srvmon
|
|
|
|
Real-time monitor for [Caddy](https://caddyserver.com/) access logs. Displays two columns:
|
|
|
|
- **Latest**: recent activity, grouped into consecutive runs by service
|
|
- **Top**: all-time request counts per service, sorted descending
|
|
|
|
Watches the log directory with inotify so updates appear instantly. Handles both plain `.access.log` files and rotated `.access.log.gz` archives. Persists state to `.srvmon.state.json` in the log directory to avoid re-counting on restart.
|
|
|
|
## Requirements
|
|
|
|
- Linux (uses inotify)
|
|
- Caddy access logs in JSON format (`<service>.access.log`)
|
|
|
|
## Building
|
|
|
|
```
|
|
cargo build --release
|
|
```
|
|
|
|
## Usage
|
|
|
|
```
|
|
srvmon [OPTIONS]
|
|
```
|
|
|
|
| Option | Default | Description |
|
|
|---|---|---|
|
|
| `-d, --dir <DIR>` | `/var/log/caddy` | Log directory path |
|
|
| `-l, --lines <N>` | `8` | Number of lines per column |
|
|
| `-b, --bind <ADDR>` | `127.0.0.1` | HTTP server bind address |
|
|
| `-p, --port <PORT>` | `8080` | HTTP server port |
|
|
| `--no-tui` | | Disable terminal display |
|
|
| `--no-http` | | Disable HTTP server |
|
|
|
|
## HTTP interface
|
|
|
|
By default, srvmon serves a web UI on `http://127.0.0.1:8080` that mirrors the terminal display via Server-Sent Events. The SSE endpoint is available at `/events`.
|