Skip to content

nexus-proxy logs

nexus-proxy writes two logs, the way an nginx in front of the engines writes access.log and error.log:

  • the access log: one line per request, and one per client that failed to set up a TLS connection;
  • the error log: what went wrong on the proxy’s side or at an engine. This is the log to alert on: every line with "level":"error" or "level":"warn".

Both are JSON, one object per line. By default the access log goes to stdout and the error log to stderr; each can go to a file instead, which the proxy rotates and prunes itself.

stderr also carries the proxy’s start lines, in plain text and whatever error_log says: nexus-proxy listening on <address> (and nexus-proxy gRPC listening on <address> when the gRPC listener is configured) once the ports are bound, or the single nexus-proxy: invalid config: … line of a refused configuration. With the default error log, these share stderr with its JSON lines.

The access line

One line per request, written when the response ends or the request is refused. Every key is always present, in this order:

Key Meaning
ts When the line was written: RFC 3339, UTC, milliseconds (2026-11-15T09:12:03.481Z).
client The client’s socket address, ip:port.
method The request method; null when the proxy could not read it from a head it could not parse.
path The request path, without the query string; null when the proxy could not read it from a head it could not parse.
status The HTTP status the client received.
bytes_in Bytes of request body read from the client.
bytes_out Bytes of response body sent to the client. On a client_timeout line for a response cut because the client did not take it, an upper bound of what reached the client: on HTTP/2 it can include bytes of other requests on the same connection.
duration_ms Whole milliseconds from the request’s arrival to the end of its response.
protocol The client’s protocol: HTTP/1.0, HTTP/1.1 or HTTP/2.0; null on the line of a head the proxy could not parse (status 400 or 431, outcome bad_request).
engine The engine address that served or failed the request; null when no engine was contacted.
engine_ms Whole milliseconds from the start of the attempt at that engine to the end of its response, or to the error or timeout that ended it; never above duration_ms. After a failover it counts only the last attempt. null when engine is null.
outcome ok, bad_request, body_too_large, client_timeout, no_healthy_engine, engine_unreachable, engine_failed or engine_timeout.
request_id 32 lowercase hexadecimal characters, unique per request within one proxy process. The error-log lines of the same request carry the same value.
correlation_id The response’s X-Correlation-ID; null when the engine sent none.
referer The request’s Referer, cut before its first ? or #, with any user:password@ removed; null when absent.
user_agent The request’s User-Agent; null when absent.

duration_ms minus engine_ms is the time spent on the client’s side and in the proxy: a slow client and a slow engine are told apart from the line alone.

referer and user_agent are read as bytes, invalid UTF-8 is replaced by U+FFFD, each is cut to at most 512 bytes, and both are written JSON-escaped: no header value can end a line or add a key.

Nothing else from the request is logged: no query string, no Authorization, Cookie or X-API-Key in any form, no other header value, no body. A request that failed over to another engine writes one line, naming the engine that answered.

An HTTP line:

{"ts":"2026-11-15T09:12:03.481Z","client":"10.0.4.17:51522","method":"POST","path":"/flows/orders","status":201,"bytes_in":512,"bytes_out":96,"duration_ms":42,"protocol":"HTTP/1.1","engine":"10.0.8.2:9090","engine_ms":39,"outcome":"ok","request_id":"5f0c2a9e41d7b3880000000000000a1c","correlation_id":"c-7781","referer":"https://portal.example/orders","user_agent":"orders-client/2.4"}

A line of the gRPC listener adds "listener":"grpc" and the call’s grpc_status; its engine is the engine’s gRPC door, and referer and user_agent are always null, because no gRPC metadata value except the correlation id is logged:

{"ts":"2026-11-15T09:12:04.007Z","client":"10.0.4.17:51540","method":"POST","path":"/shop.Orders/Get","status":200,"bytes_in":25,"bytes_out":40,"duration_ms":6,"protocol":"HTTP/2.0","engine":"10.0.8.2:9091","engine_ms":5,"outcome":"ok","request_id":"5f0c2a9e41d7b3880000000000000a1d","correlation_id":"c-7782","referer":null,"user_agent":null,"listener":"grpc","grpc_status":0}

The access log also holds one line per TLS handshake that did not complete, the client’s failure to set up a connection:

{"ts":"2026-11-15T09:12:05.300Z","event":"tls_handshake_failed","client":"10.0.4.99:40112","reason":"peer sent no certificates"}

The error log

Every line has ts, level (error, warn or info) and event, then the keys of its event. A reason is the text of the operating system, HTTP or TLS error, or a fixed text; it never holds a header value, query string, body or certificate content. These are all the events; the proxy writes no other JSON line to the error log. When the error log is stderr, the plain-text start lines described at the top of this page sit beside them.

event level Keys Written when
engine_state warn to unhealthy, info to healthy engine, state (healthy, unhealthy), reason (null to healthy), "listener":"grpc" for a gRPC target an engine or a gRPC target changes state
engine_attempt_failed warn when the request then goes to another engine, error otherwise request_id, engine, kind (connect, after_send, timeout), reason, "listener":"grpc" on that listener an attempt at an engine fails; a timeout’s reason is no response head within response_ms
crl_reloaded info none a CRL file changed and the new set is in force
crl_reload_failed error key (the file’s JSON path, tls.client_auth.crls[0]), reason a reload attempt failed; the previous set stays in force
log_write_failed error log (access), reason, dropped access lines could not be written
log_rotate_failed error log (access, error), reason a log file could not be rotated
log_retention_failed warn log, file, reason a rotated file could not be deleted
accept_failed error reason, failed (the failed accepts of that listener since its previous accept_failed line, this one included), "listener":"grpc" on that listener the proxy could not accept a new connection, most often because it has run out of file descriptors
grpc_listener_failed error reason (no grpc settings when the listener has no grpc settings) the gRPC listener cannot serve after its start line; the HTTP listener keeps serving

request_id joins an engine_attempt_failed line to the request’s access line:

{"ts":"2026-11-15T09:12:06.120Z","level":"warn","event":"engine_attempt_failed","request_id":"5f0c2a9e41d7b3880000000000000a1e","engine":"10.0.8.3:9090","kind":"connect","reason":"client error (Connect): tcp connect error: Connection refused (os error 111)"}
{"ts":"2026-11-15T09:12:06.122Z","level":"warn","event":"engine_state","engine":"10.0.8.3:9090","state":"unhealthy","reason":"client error (Connect): tcp connect error: Connection refused (os error 111)"}

A listener’s first failed accept writes accept_failed at once; while accepts keep failing, that listener writes at most one more every 60 s, with failed counting the failures since its previous line:

{"ts":"2026-11-15T09:30:00.004Z","level":"error","event":"accept_failed","reason":"Too many open files (os error 24)","failed":1}

A client’s own failures (400, 408, 413, a failed TLS handshake) are in the access log only.

A log never stops traffic. A line is written whole, with one write call. An access line that cannot be written is dropped and the response is unchanged; a log_write_failed line reports it at once, then at most once every 60 s while writes keep failing, each with the lines dropped since the previous one. An error-log line that cannot be written goes to stderr instead; if that fails too, it is dropped. log_rotate_failed and log_retention_failed are also written at most once every 60 s per log.

Settings

Two top-level objects of the proxy’s configuration, of the same shape:

Key Default Accepted Refused
to stdout for access_log, stderr for error_log, when the object is absent "stdout", "stderr" or an absolute file path whose directory exists a relative path, a missing directory, the same path for both logs; required when the object is present
rotate_bytes 104857600 (100 MiB) an integer from 1048576 up, or null below 1048576; null together with rotate_every null
rotate_every "day" "hour", "day" or null any other value
keep_files 14 an integer from 1 to 1000, or null 0, above 1000; null together with keep_days null
keep_days null an integer from 1 to 3650, or null 0, above 3650

With to set to stdout or stderr, any of the other four keys is refused: rotation and retention of a stream belong to whatever collects it. An unknown key inside either object is refused. A refused setting stops the start: one stderr line naming the JSON path (access_log.keep_days, error_log.to) and the reason, exit code 2, no port bound. The file is created if absent and opened for append.

On a VM, to files:

"access_log": { "to": "/var/log/nexus-proxy/access.log",
"rotate_bytes": 104857600, "rotate_every": "day", "keep_files": 14 },
"error_log": { "to": "/var/log/nexus-proxy/error.log",
"rotate_every": "day", "keep_files": 14, "keep_days": 30 }

In a container, leave both out: the access log goes to stdout and the error log to stderr.

Rotation and retention

Only a file is rotated. Before a line is written, the file is rotated if it is not empty and the line would take it past rotate_bytes; a single line longer than rotate_bytes is written alone in its file. With rotate_every, a non-empty file whose first line was written in an earlier UTC hour or day is rotated on the proxy’s 60 s tick or before the next line, so within 60 s of the boundary; at start, the file’s modification time decides. An empty file is never rotated.

To rotate, the proxy renames access.log to access.log.20261115T091203Z, the UTC moment of the rotation (-1, -2, … added when that name exists), then creates a new access.log. Rotated files are not compressed. If the rename or the creation fails, the proxy keeps writing to the file it has open and tries again at the next trigger.

Retention runs at start, after each rotation and on the 60 s tick. It considers only regular files in the log’s directory whose name is exactly the log’s name, a dot, a timestamp of that form and an optional -n. keep_files keeps the newest that many; keep_days deletes those whose name’s timestamp is older than that many days; with both, a file goes when either says so. Age is read from the name, not the modification time. The live file, symbolic links, other logs’ files and any other name (access.log.bak, a .gz you made) are never deleted.

A log file the proxy creates, at start or by rotation, has mode 0640 (the process umask can only narrow it): the lines hold client addresses and paths. An existing file keeps its mode.

Two proxy processes must not share a log path: nothing detects it, and their rotations would rename each other’s file.

How a collector reads them

  • Every line is one JSON object; no line spans two lines. The one exception is stderr: its start lines are plain text and begin with nexus-proxy, not {, so a collector of stderr skips a line that does not start with { or keeps it as text.
  • A file collector follows each log by name and inode: the rename keeps the old file’s inode, so the collector reads it to its end, then opens the new file by name. Match the rotated names (access.log.*) only to read what was written while the collector was down. Copy-then-truncate is not used and not needed.
  • In a container, the runtime collects stdout and stderr and owns their rotation.
  • Lines carry no host name: the collector adds the host, which also tells two proxies’ request_id values apart.
  • Alert on the error log’s level error and warn; group engine_attempt_failed by engine and kind, and join it to the access log on request_id.