Files
RustProxy/docs/LIVE_LOGS.md
T
2026-10-03 00:27:09 +01:00

2.7 KiB

Interactive live logs

RustProxy provides an operator CLI that follows structured request/error events from every HTTP vhost:

rust-proxy --livelogs

The command connects only to the loopback administration listener and creates a bounded local CLI session from the private RustProxy database. When ./data/config.sqlite3 is absent, the bare command discovers common installed layouts: /var/lib/rustproxy is preferred on Linux/non-BSD systems and /var/db/rustproxy on BSD/OPNsense-style installations, with the alternate convention checked as a fallback. An explicit --data-dir always wins and custom installations should pass the same path used by the service. --admin-listen can select a non-default loopback port.

Administration HTTP/HTTPS transport

The CLI first probes the loopback administration /healthz endpoint over HTTP. An HTTP-only administration listener stays on HTTP; the 308 Permanent Redirect emitted by a TLS-enabled administration listener switches the CLI to HTTPS before a CLI session cookie is sent. HTTPS is pinned to leaf certificates present in the private <data-dir>/certs directory, so a configured self-signed administration certificate does not require a system trust-store installation.

This fixes the previous reconnect loop where --livelogs treated the TLS listener's expected HTTP-to-HTTPS 308 response as a stream failure. The same local transport selection is used by CLI config and certificate API operations.

The live path is separate from configured file/syslog sinks. Request processing publishes into a bounded Tokio broadcast channel without waiting for viewers. A slow viewer receives an explicit gap event with the number of entries lost from that viewer's live queue. The CLI also consults the retained history after connecting/reconnecting and de-duplicates entries by request id.

Interactive commands

No regex language is required. Type commands while the stream is running:

host api.example.com
vhost api
backend origin-a
route users
client 192.0.2.10
method GET
transport h2
cache MISS
status 5xx
path /api/
errors on
slow 250
detail on
filters
show 12345
pause
resume
reset
clear
quit

Use * to clear a scalar filter, for example backend *, and slow off / errors off for boolean filters. show ID prints the complete retained structured event for that request. detail on expands the continuously printed view with route/upstream/cache/transform/WebSocket/H3/byte metadata.

The server revalidates the streaming session every 10 seconds rather than writing session state for every request. Password changes, session revocation or expiry therefore terminate an existing stream within that bounded interval.