Skip to main content

tcp-logger

tcp-logger

Ships a JSON access-log entry for each request/response to a remote TCP endpoint (Logstash, Fluentd, a raw TCP collector, ...). Entries are buffered in a batch sink and delivered by a background task that opens a fresh TCP connection 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 — it never blocks on the network. Place this node in the response pipeline after the upstream node, so the final status, latency, and body size are available.

Configuration

KeyTypeDefaultDescription
hoststring— (required)TCP server hostname or IP.
portinteger— (required)TCP server port (0–65535).
timeoutinteger (ms)1000Connect/send timeout.
tlsboolfalseNot yet supportedtrue is rejected at config load.
tls_optionsstringAccepted but ignored (TLS unsupported).
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; 1 flushes every entry immediately.
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 flush.
retry_delayinteger (s)1Delay between retries.
max_pending_entriesinteger10000Queue capacity; entries are dropped (with a warning) when full.
- id: tcp-log
type: tcp-logger
config:
host: 127.0.0.1
port: 5044
timeout: 1000
batch_max_size: 100

Behavior

Builds the shared access-log entry (default structured object, or the flat log_format object when configured), pushes it to the batch sink, and passes the context through unchanged. The node is a pure passthrough: it never modifies the context and never fails, so only its success port is ever taken. A failed TCP flush is retried per the batch keys and otherwise logged and dropped.

Behavior notes

  • Entries are always sent as newline-delimited JSON (one object per line). The wire format is stable regardless of batching.
  • tls / tls_options are not yet supported; tls: true is rejected. Plain TCP only.