Skip to main content

file-logger

file-logger

Appends a JSON access-log entry for each request/response to a local file. Entries are handed to a batch sink; a background task opens the target file in append mode per flush and writes each entry as one newline-delimited JSON object.

Delivery is fire-and-forget: execute builds the entry, hands it to the sink, and returns the context unchanged. Place this node in the response pipeline after the upstream node.

Configuration

KeyTypeDefaultDescription
pathstring— (required)Target file path. Opened in append mode; created if absent. Its parent directory must already exist.
log_formatobjectCustom name -> "$var" entry; replaces the default structured entry.
include_req_bodyboolfalseAdd the request body to the default entry.
include_resp_bodyboolfalseAdd the response body to the default entry.
batch_max_sizeinteger1000Entries per batch; set 1 for immediate per-request writes.
inactive_timeoutinteger (s)5Flush when idle this long.
buffer_durationinteger (s)60Flush when the oldest buffered entry is this old.
max_retry_countinteger0Retries after a failed write.
retry_delayinteger (s)1Delay between retries.
max_pending_entriesinteger10000Queue capacity; entries are dropped (with a warning) when full.
- id: file-log
type: file-logger
config:
path: /var/log/featherbit/access.log
batch_max_size: 1

Behavior

Builds the shared access-log entry, pushes it to the batch sink, and passes the context through unchanged. The node is a pure passthrough: only its success port is ever taken. If the file cannot be opened or written (for example, a missing parent directory), the flush fails and is retried/dropped per the batch keys.

Behavior notes

  • Writes are routed through the shared batch sink for consistency with the other loggers. Set batch_max_size: 1 to write every entry as it arrives.
  • The parent directory is not created: if it is missing the flush fails. The file itself is created if absent.