Expand description
The tcp-logger node — ships per-request access-log entries to a remote
TCP endpoint (a log collector such as Logstash, Fluentd, or a raw TCP
sink), mirroring APISIX’s tcp-logger plugin.
Entries are built with the shared build_entry
helper, buffered in a BatchSink, and delivered by a background task that
opens a fresh [tokio::net::TcpStream] per flush, writes each entry as one
newline-delimited JSON object, and closes the connection. Delivery is
fire-and-forget on the request path: Plugin::execute never blocks on
the network and always returns the context unchanged, so this node should be
placed in the response pipeline after the upstream node where the
final status and body size are available.
§Deviations from APISIX
- Entries are always sent as newline-delimited JSON (one object per line),
rather than APISIX’s “single object when
batch_max_size == 1, JSON array otherwise” shape. This keeps the wire format stable regardless of batching. tls/tls_optionsare not yet supported; configuringtls: trueis rejected at config load. Plain TCP only.
Structs§
- TcpFlusher 🔒
BatchFlusherthat connects tohost:portand writes the batch.- TcpLogger
Plugin - The
tcp-loggerplugin node.
Functions§
- entries_
to_ 🔒lines - Serializes each entry as one line of JSON, newline-terminated, and concatenates them into the payload written to the socket. Pure and independent of the network so it can be unit-tested directly.