From 8bd674fda0799b214b5182a1317dbe540bdb66ea Mon Sep 17 00:00:00 2001 From: luisdralves Date: Tue, 31 Mar 2026 22:51:46 +0100 Subject: [PATCH] Add readme --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae12160 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# 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 (`.access.log`) + +## Building + +``` +cargo build --release +``` + +## Usage + +``` +srvmon [OPTIONS] +``` + +| Option | Default | Description | +|---|---|---| +| `-d, --dir ` | `/var/log/caddy` | Log directory path | +| `-l, --lines ` | `8` | Number of lines per column | +| `-b, --bind ` | `127.0.0.1` | HTTP server bind address | +| `-p, --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`.