RFC5424 syslog

Available in AxoSyslog 4.21 and later.

Formats data as an RFC5424 (IETF-syslog) syslog message.

Usage:

format_syslog_5424(
  message,
  add_octet_count=false,
  pri=<variable-or-expression>,
  timestamp=<variable-or-expression>,
  host=<variable-or-expression>,
  program=<variable-or-expression>,
  pid=<variable-or-expression>,
  msgid=<variable-or-expression>
)

Setting the message option is required. You can set the other options using any FilterX variable, function, or expression. If you specify a nonexisting variable, or if evaluating an expression fails, default values will be used.

If you want to include SDATA in the message, set the SDATA macro.

For example:

format_syslog_5424("My static message text", timestamp=datetime(1765146872.0), host="host-value", program="prog-value", pid="5424", msgid="1234");

Becomes:

<13>1 2025-12-07T22:34:32.000000+00:00 host-value prog-value 5424 1234 - My static message text
Last modified December 17, 2025: Adds filterx format_syslog_5424 (a15b290)