Lightweight observability backend for logs and distributed traces.
Accepts logs via HTTP push, collects from Docker containers, receives OpenTelemetry (OTLP) traces, and provides a Loki-compatible query API. Uses embedded RocksDB for storage. Comes with a built-in terminal UI.
- Log ingestion -- HTTP push API, Loki-compatible push, Docker container log collection
- Distributed tracing -- OTLP trace ingestion with span correlation
- Loki-compatible API -- query logs with
{service="my-app", level="error"}selectors - Docker collector -- streams stdout/stderr from configured containers, auto-detects log levels
- Terminal UI -- browse logs and traces, filter by service/environment, search, live tail
- Embedded storage -- RocksDB, no external dependencies
- Single binary -- server, collector, and Docker watcher in one process
# Build
cargo build --release
# Run server with local config
cargo run -p server -- --config rgrab.toml
# Open TUI
cargo run -p tuiCopy rgrab.example.toml to rgrab.toml and adjust:
data_dir = "./data/rgrab"
listen = "0.0.0.0:3000"
log_level = "info"
[docker]
enabled = true
socket = "/var/run/docker.sock"
[[docker.containers]]
name = "my-app"
service = "backend"
environment = "production"
[[docker.containers]]
name = "nginx"
service = "nginx"
environment = "production"When docker.enabled = true, the server connects to the Docker daemon and streams logs from the listed containers. Each log entry gets labels:
| Label | Source |
|---|---|
service |
service field from config, or container name |
environment |
environment field from config |
container_name |
Docker container name |
container_id |
Short container ID |
image |
Docker image name |
stream |
stdout or stderr |
The collector automatically attaches to new containers when they start and detaches when they stop.
# Push logs (JSON array of LogEntry)
curl -X POST http://localhost:3000/v1/logs \
-H 'Content-Type: application/json' \
-d '[{"timestamp":"2025-01-01T00:00:00Z","level":"INFO","message":"hello","labels":{"service":"test"}}]'
# Loki-compatible push
curl -X POST http://localhost:3000/rgrab/api/v1/push \
-H 'Content-Type: application/json' \
-d '{"streams":[{"stream":{"service":"test"},"values":[["1704067200000000000","hello"]]}]}'# Push traces (OpenTelemetry JSON format)
curl -X POST http://localhost:3000/otlp/v1/traces \
-H 'Content-Type: application/json' \
-d @traces.json# List labels
curl http://localhost:3000/rgrab/api/v1/labels
# Label values
curl http://localhost:3000/rgrab/api/v1/label/service/values
# Query logs with selector
curl 'http://localhost:3000/rgrab/api/v1/query?query={service="my-app"}&limit=100'
# Query range
curl 'http://localhost:3000/rgrab/api/v1/query_range?query={level="error"}&start=1704067200&end=1704153600'cargo run -p tui -- --server http://localhost:3000| Key | Action |
|---|---|
Tab |
Switch between Logs / Traces |
j/k |
Scroll down / up |
h/l |
Focus sidebar / main panel |
Enter |
Select filter / expand trace |
/ |
Search |
1-6 |
Toggle log levels (TRACE..FATAL) |
L |
Toggle live tail |
r |
Refresh |
s |
Toggle sort order |
q |
Quit |
crates/
common/ Shared types (LogEntry, Span, label selectors)
collector/ HTTP ingestion endpoints
docker-collector/ Docker container log collection
storage/ RocksDB persistence layer
web/ Loki-compatible query API
server/ Main binary (merges all components)
tui/ Terminal UI client
cargo install --path crates/server
cargo install --path crates/tui# Install cargo-deb (one-time)
cargo install cargo-deb
# Build release binaries and package
cargo build --release
cargo deb -p server --no-build
# Install locally
sudo dpkg -i target/debian/rgrab_*.deb
sudo systemctl enable --now rgrabThe deb package installs:
/usr/bin/rgrab-- server binary/usr/bin/rgrab-tui-- terminal UI/etc/rgrab/rgrab.toml-- configuration (preserved on upgrade)- systemd service
rgrab
The deploy.sh script builds the deb package and deploys it to a remote server over SSH:
# Build, upload, install, and restart in one command
infra/deploy.sh root@your-server.com
# Or with a custom SSH user
infra/deploy.sh deploy@192.168.1.10The script does the following:
- Builds release binaries (
cargo build --release) - Creates a deb package (
cargo deb) - Copies the package to the server via
scp - Installs it with
dpkg -iand restarts the service
Requirements:
- SSH access to the server (key-based auth recommended)
cargo-debinstalled locally (cargo install cargo-deb)- The server must be Debian/Ubuntu-based
MIT
