Skip to main content

Module udp_logger

Module udp_logger 

Source
Expand description

The udp-logger node — ships per-request access-log entries to a remote UDP endpoint, mirroring APISIX’s udp-logger plugin.

Entries are built with the shared build_entry helper, buffered in a BatchSink, and delivered by a background task that binds an ephemeral [tokio::net::UdpSocket] and sends each entry as one datagram of JSON bytes to host:port. UDP is inherently fire-and-forget: a send that the kernel accepts is considered delivered; only local errors (name resolution, socket) surface as flush failures.

Delivery never blocks the request path — Plugin::execute pushes the entry and returns the context unchanged — so this node should be placed in the response pipeline after the upstream node.

§Deviations from APISIX

  • Each entry is sent as its own datagram (one JSON object per packet), rather than APISIX’s “single object when batch_max_size == 1, JSON array otherwise” shape.

Structs§

UdpFlusher 🔒
BatchFlusher that sends each entry as one UDP datagram to host:port.
UdpLoggerPlugin
The udp-logger plugin node.

Functions§

entry_to_datagram 🔒
Serializes one entry to its datagram payload (compact JSON bytes). Pure and network-independent for unit testing.