Skip to main content

http-logger

http-logger

Builds a JSON access-log entry for each request/response and ships accumulated batches to an arbitrary HTTP endpoint. Entries are queued with a non-blocking, fire-and-forget push; a background task POSTs them once a batch fills, goes idle, or ages out. Place this node in the response pipeline, after the upstream node, so the final status and body size are captured.

Configuration

KeyTypeDefaultDescription
uristring— (required)HTTP endpoint batches are POSTed to.
methodstringPOSTHTTP method for the callout.
headersobject{}Extra request headers applied to every batch.
auth_headerstringConvenience for a single Authorization header value.
concat_methodstringjsonjson sends a JSON array (application/json); new_line sends \n-separated JSON objects (text/plain).
ssl_verifyboolfalseVerify TLS certificates for https endpoints.
timeoutinteger (s)3Whole-call deadline per flush.
log_formatobjectCustom flat entry of name -> "$var template". When absent, the default structured entry is used.
include_req_bodyboolfalseAdd the request body to the default entry.
include_resp_bodyboolfalseAdd the response body to the default entry.
batch_max_sizeinteger1000Flush when the buffer reaches this many entries.
inactive_timeoutinteger (s)5Flush after this idle period.
buffer_durationinteger (s)60Flush when the oldest buffered entry is this old.
max_retry_countinteger0Retries after a failed flush before dropping the batch.
retry_delayinteger (s)1Delay between retries.
max_pending_entriesinteger10000Queue capacity; entries are dropped with a warning when full.
- id: access-log
type: http-logger
config:
uri: http://log-collector:3000/logs
method: POST
headers:
X-Token: secret
concat_method: json
batch_max_size: 1000
inactive_timeout: 5

Behavior

The node is a pure passthrough: it never modifies the context and never fails, so only its success port is ever taken. push is fire-and-forget and never blocks the request path — when the queue is full (a slow or retrying endpoint) entries are dropped with a tracing::warn!, which is the operator's signal to raise max_pending_entries or fix the downstream. Delivery, batching, timing, and retries all happen on a background task. On config reload the old sink is drained and flushed before a new one is spawned.