Skip to main content

Module syslog

Module syslog 

Source
Expand description

The syslog node — ships per-request access-log entries to a remote syslog server as RFC 5424 framed messages, over TCP or UDP, mirroring APISIX’s syslog plugin (apisix/plugins/syslog/init.lua).

Each entry is built with the shared build_entry helper, JSON-encoded, and wrapped in an RFC 5424 header (<priority>1 timestamp hostname app-name procid - msg) exactly as APISIX does via apisix/utils/rfc5424.lua. APISIX hard-codes facility SYSLOG (5) and severity INFO (6), giving priority 5*8+6 = 46; the hostname is the request Host and the procid is the gateway process id. The framed strings are buffered in a BatchSink and flushed as a single concatenated payload over a fresh TCP or UDP socket per flush.

Delivery is fire-and-forget on the request path — Plugin::execute pushes the framed message and returns the context unchanged — so place this node in the response pipeline after the upstream node.

§Deviations from APISIX

  • tls is not yet supported; tls: true is rejected at config load.
  • flush_limit, drop_limit, and pool_size are accepted for schema compatibility but not honored; batching is governed by the shared BatchConfig knobs instead.

Structs§

SyslogFlusher 🔒
BatchFlusher that concatenates the framed messages and sends them over TCP or UDP.
SyslogPlugin
The syslog plugin node.

Enums§

SockType 🔒
Transport for the syslog socket.

Constants§

FACILITY_SYSLOG 🔒
Syslog facility SYSLOG (5), matching APISIX’s hard-coded choice.
SEVERITY_INFO 🔒
Syslog severity INFO (6), matching APISIX’s hard-coded choice.

Functions§

build_syslog_frame 🔒
Builds one RFC 5424 syslog frame. Pure and independent of the clock/network (the timestamp is passed in) so it can be unit-tested against a known value.
format_rfc3339 🔒
Formats an epoch-seconds/millis pair as an RFC 3339 Zulu timestamp using the civil-from-days algorithm (no external date crate).
priority 🔒
RFC 5424 priority value: facility * 8 + severity.
rfc3339_now 🔒
Current time as an RFC 3339 “Zulu” timestamp (YYYY-MM-DDTHH:MM:SS.mmmZ), matching APISIX’s get_rfc3339_zulu_timestamp.