diff options
| author | Pjotr <wrk@bosa.lan> | 2026-11-14 13:27:44 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-11-14 13:27:44 +0000 |
| commit | f64a7084694fc28fc2069e39778a83716c1b858e (patch) | |
| tree | f2f25b8eff4548a4610f4383cf3bafa45057adfb /docs | |
| parent | 96c1979e5d4b662e8b4426dc7e9a27a5b7742c67 (diff) | |
| download | genenetwork4-f64a7084694fc28fc2069e39778a83716c1b858e.tar.gz | |
logs: one access line per request, naming the caller
The proxy logs the caller through x-gn4-user, but the process log -- the one an
operator tails while a job runs -- named nobody, so "who started this GEMMA
run" meant going to the nginx log or guessing. genenetwork4 now writes one
compact JSON line per request on stderr:
{"event":"request","method":"GET","path":"/groups/BXD","status":200,
"took_ms":10,"request_id":"…","user":"zachs"}
Decisions in it: `user` is absent, not "-", when no token was verified (a dash
is a value a reader can mistake for a user name); the path is logged without
its query string, because a query can carry a credential and has no business
in a log; the token value itself is never logged, only its subject; and the
line carries the `request_id`, so it sits beside the existing `event: error`
lines for 5xx and one grep joins a failure to the request that caused it.
`GN4_ACCESS_LOG=false` turns it off where the proxy's log is the record of
truth.
Verified on a probe instance: with the test token the line says
user "gn4-test-stub", with zachs's token user "zachs", and an unauthenticated
401 has no user field at all.
docs/www/operator-checklist.md claimed "genenetwork4 does not log the token's
sub" -- true until now, which is exactly the kind of sentence that rots; it is
replaced by the line above, what it contains and what it deliberately omits.
README's x-gn4-user paragraph gains the same, next to the identity it already
described.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/www/operator-checklist.md | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/docs/www/operator-checklist.md b/docs/www/operator-checklist.md index 09d188b..25cc2c0 100644 --- a/docs/www/operator-checklist.md +++ b/docs/www/operator-checklist.md @@ -359,10 +359,21 @@ changes on every build, so it distinguishes two builds of the same commit. the token's subject, so per-user success is `awk '{print $9, $10}'` away instead of inferred from addresses) and the user agent. `user=-` means the request carried no valid token: scanners and anonymous reads, never - a caller whose token failed after authenticating. genenetwork4 does **not** log the - token's `sub`, so attribution stops at the token you handed out — if - that matters, mint one token per consumer and correlate by the token - file, or wait for gn-auth. + a caller whose token failed after authenticating. +* **genenetwork4 writes its own access line too**, one JSON object per request + on stderr, naming the caller: + + ```json + {"event":"request","method":"GET","path":"/groups/BXD","status":200,"took_ms":10,"request_id":"…","user":"zachs"} + ``` + + So `tail -f` on the process log answers "who ran this job" without going + through the proxy's log — which matters while watching a run, and it is the + same log the `event: error` lines go to, correlated by `request_id`. + `user` is **absent** (not `-`) when no token was verified. The path is + logged without its query string, and the token itself is never logged — + only its subject. Turn it off with `GN4_ACCESS_LOG=false` where the proxy's + access log is the record of truth. * A `/search` `total`/facet would end the paging-to-count pattern that costs ~23 s per 15 000 hits; see [`../search-engines.md`](../search-engines.md). |
