7.0 KiB
Live logs, stored logs and error logging
RustProxy has several independent logging paths. Choose the one matching the question; enabling stored file logging is not required to view recent in-memory requests.
Live Logs
The administration panel does not fetch /api/logs while Live Logs is closed. Opening or docking the Live Logs window starts the bounded live snapshot refresh; closing it stops that polling. Pausing or expanding the history buffer also suspends periodic /api/logs reads until live viewing resumes. The main /api/events status stream is kept independent by using logs=false in the panel.
Use Logs → Live Logs in the authenticated panel, or locally:
rust-proxy --data-dir /var/lib/rustproxy --livelogs
The CLI connects to the local administration listener and follows structured request events. It can filter by host, Vhost, backend, route, method, client, protocol, status, cache state and latency; use filters, pause, resume, detail on and quit in the interactive view. It adapts to a loopback administration HTTPS listener where configured.
For a published Docker application, Docker vhosts → Live logs (beside Open app) opens this same dialog filtered to the generated Vhost. It includes HTTP traffic for that publication and its aliases. It does not display Docker container stdout/stderr; the Docker agent remains inventory-only.
Live viewing is bounded in memory. Slow consumers may receive a gap/loss indication and are not allowed to block proxy traffic. Low-level malformed HTTP/TLS/H2/H3 protocol errors can be sent only to persistent sinks rather than appearing in the ordinary live request list. A request ID (X-Request-ID) helps correlate an application response with proxy records.
Stored Logs
The authenticated Logs → Stored logs page reads the configured structured JSON/JSONL access logs, optional per-Vhost files and optional error log. These files can remain readable even when their current writer is disabled. The explorer supports paging, dynamic columns, sorting, record expansion/Raw JSON and repeated-value analysis.
How to use it (0.41.1):
- Source lists one entry per log, grouped as Vhosts, Redirect hosts, 404 hosts, Other traffic (
_unmatched), Shared access log and Error log. A log includes all its rotations. - File narrows a log to one file: the current file,
.1,.2.gz, … Rotations are always ordered by their number (newest data first), not by file modification time, so a touched or copied.10.gzno longer appears first. Uncompressed rotations (.1with logrotatedelaycompress) are included. - A log is read newest first: the current file may use the whole scan budget, and older rotations are read only while budget remains. The status line shows the range of matching records, which files were read and, if older files were left out, how to browse them (choose the file).
- Period (15 minutes … 7 days) filters by record time and stops before rotations that are entirely older. Status chips filter 2xx/3xx/4xx/5xx or protocol errors on the server.
- Search syntax opens as a panel under the search field (also on phones); tap an example to use it. ← Newer / Older → page through the results.
Per-site files and rotation
With per-Vhost access logs enabled, every site has its own file in the configured directory:
| File | Traffic |
|---|---|
<vhost>.jsonl |
requests handled by a Vhost |
<id>.redirect.jsonl |
requests answered by a redirect host (records carry redirect_host) |
<id>.host404.jsonl |
requests answered by a local 404 host (records carry local_host) |
_unmatched.jsonl |
requests for hosts that match nothing |
Before 0.41.1 redirect and 404 hosts were logged to _unmatched.jsonl (or the shared file). The extra fields are omitted for other records, so existing parsers are unaffected.
RustProxy now notices external rotation: about once per second it checks whether the configured path still names the open file and reopens it after logrotate (create mode), mv or deletion. A standard policy is enough — no postrotate signal and no copytruncate is needed:
/var/log/rustproxy/*.jsonl /var/log/rustproxy/vhosts/*.jsonl /var/log/rustproxy/error.log {
daily
rotate 14
compress
delaycompress
missingok
notifempty
create 0600 rustproxy rustproxy
}
delaycompress keeps the last rotation uncompressed for the second during which RustProxy may still finish a write to it. Earlier versions kept writing into the renamed (and, after compression, deleted) file until a restart, so records written after a rotation could be missing from disk; restart the service once after upgrading if you rotate logs externally.
Search uses a restricted case-insensitive query syntax, for example:
status:>=500 AND path:/api/*
client_ip:192.0.2.* AND status:5xx
method:POST AND !country:Poland
error:"connection reset"
Plain words search stored values; quotes allow spaces, ! negates a clause, * matches wildcards and numeric operators work on supported fields. OR is not supported. Searches and repeated-value statistics are bounded by server scan limits; do not interpret a truncated result as the entire historical archive.
Error and protocol logs
RustProxy can persist warnings/errors and selected protocol failures separately from access traffic. Set output level, sink and optional retention/rotation under Settings → Logging and related error-log controls. Access logs may use the global structured file or per-Vhost locations. Log paths must be writable by the service identity, including when running inside a container/systemd sandbox.
The installed Linux deployment may configure logrotate for durable logs; check the installed policy rather than assuming all platforms rotate automatically. Logging is bounded/asynchronous where practical, and some records can be dropped under saturation; inspect sink drop/error counters in monitoring.
Privacy and investigation
Logs can contain client IPs, URLs, application hostnames and timing metadata. Limit access and retention. RustProxy masks selected known credential fields, but avoid deliberately logging secrets or personal data in query parameters and custom headers. The administration API and stored-log search remain behind authentication.
For common symptoms:
- 502/503/504: correlate request ID, Vhost and backend health with upstream timeout/connect/TLS errors.
- 403/405/429: inspect ACL, method rule, country or rate limiting.
- Unexpected cache result: inspect optional
X-Cachediagnostics and Cache dashboard alongside request logs. - Files empty: enable the correct sink and check permissions, path and rotation state. If only old rotations hold data (e.g. the newest records are in
.10.gzand the current file stays empty), the service was running a version older than 0.41.1 during a rotation; restart it once. - Protocol failures missing from Live Logs: inspect configured persistent error/protocol logs instead.
Also see Monitoring and Troubleshooting.