Stream logs to a central server¶
- Author:
Rohit Goswami
Overview¶
Serve mode lets multiple bless clients stream logs to a central server via
Cap’n Proto RPC. The server writes per-session gzip files and maintains an index.
Requires building with the serve feature.
Build with serve support¶
cargo build --release --features serve
Start the server¶
bless --serve :5678
:5678 binds 127.0.0.1:5678, not all interfaces. Pass an explicit
address such as 0.0.0.0:5678 or 192.168.1.10:5678 to listen elsewhere.
No dummy command is required.
Session data is stored under $XDG_DATA_HOME/bless/sessions/ (or
$HOME/.local/share/bless/sessions/). If neither variable is set, the
server uses .bless_sessions in the working directory.
Stream from a client¶
bless --remote :5678 --label ci-build -- make test
:5678 connects to 127.0.0.1:5678. Without --local (and without
-o) no local gzip is written.
To also keep a local gzip file:
bless --remote :5678 --local --label ci-build -- make test
Session files¶
Each session writes {label}_{uuid}.log.gz under the data directory.
The server appends one JSON object per closed session to a shared
index.json in that directory.
Architecture¶
client server
| |
|-- openSession(meta) ---->|
|<---- LogSink capability -|
| |
|-- writeBatch(lines) ---->| (flushed every 100ms)
|-- writeBatch(lines) ---->|
| |
|-- close(exit, dur) ----->| (finalizes gzip, writes index)