From d30ac9c7aede4cbc6463ec1ee80b650b7bf9e9c7 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2026 04:09:09 +0000 Subject: api: a log line per HTTP request Requests weren't logged at all, short of what a handler logs itself. Now a middleware, outermost on the API (and on a relay-only node's), logs a line per request as web servers do: method and path (with the query), status, the milliseconds until the answer began (a stream goes on after), where it came from (the address, or `unix`), and the user (`-` where none was authenticated). The user comes back on the response: `basic_auth` puts it there, for a token as for a password or a trusted proxy's header. At debug, under the target `http` (`RUST_LOG=info,http=debug`, or `PUT /admin/log`): an open dashboard alone would fill the log at info. With the target off, the request passes untouched. --- docs/measurements.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/measurements.md') diff --git a/docs/measurements.md b/docs/measurements.md index 319586e..207dc3b 100644 --- a/docs/measurements.md +++ b/docs/measurements.md @@ -13,7 +13,9 @@ Four places to read: * `GET /peers`: one entry per known peer, keyed by its node ID, with the per-peer figures. * The log: incidents as they happen (a peer going dormant, a heal, a stalled catch-up), - at warn or info; `PUT /admin/log` changes the filter at runtime. + at warn or info; `PUT /admin/log` changes the filter at runtime. A line per HTTP + request (method and path, status, milliseconds until the answer began, where from, + user) at debug under the target `http`: `RUST_LOG=info,http=debug`. * `GET /admin/dashboard` (builds with the `dashboard` cargo feature): a page with the two above and a map of the swarm, live ([`dashboard.md`](dashboard.md)). -- cgit v1.3.1