RFC 5424: Syslog: Structured event messages

Summary

In March 2009, Rainer Gerhards of Adiscon specified a standardised syslog format in RFC 5424, replacing the BSD practice that RFC 3164 had merely described. Every message carries priority, version, a timestamp according to RFC 3339, host name, application, process ID, message type and optionally structured data. RFC 5424 deliberately separated transport from the format and left it to separate documents for UDP and TLS.

From custom to format

Syslog comes from BSD Unix in the 1980s and was long a custom without a standard. In 2001 RFC 3164 had only described how existing implementations behaved, with all their vagueness: timestamps without year or time zone, no length limits, no room for machine-readable fields.

RFC 5424 defines a fixed header: priority from facility and severity, version number, timestamp with date, time, optional fractions of a second and time zone, then host name, application name, process ID and message ID. Missing values appear as a single hyphen. Structured data in square brackets and the actual message follow, preferably in UTF-8.

Transport as a separate layer

The document distinguishes content, application and transport. Every receiver must accept messages up to 480 bytes, should support 2,048 bytes and may process more. How the bytes are transmitted is governed by RFC 5426 for UDP and RFC 5425 for TLS, both also from March 2009.

The separation has proved itself: the same format runs over UDP, TCP, TLS or into files and journals today, and tools such as rsyslog, syslog-ng or systemd-journald can read and write it.

Ideas

  • Facility and severity together form a message’s priority.
  • Timestamps contain the year, fractions of a second and time zone.
  • Host name, application, process ID and message ID sit in fixed positions.
  • Structured data carries machine-readable fields alongside the text.
  • A hyphen marks missing values.
  • The format is separate from the transport.

Insights

  • Logs only become reliable operational data with unambiguous timestamps and fixed fields.
  • Separating format and transport made syslog fit for encrypted and reliable transmission without changing the format.

Facts

  • RFC 5424 appeared in March 2009 and replaces RFC 3164 from August 2001.
  • Receivers must accept messages up to 480 bytes and should support 2,048 bytes.
  • RFC 5425 (TLS) and RFC 5426 (UDP) govern transport.
  • The author Rainer Gerhards worked at Adiscon GmbH.

References

Remarks

  • Rainer Gerhards is also the main developer of rsyslog, the default syslog service of many Linux distributions.

Recommendations

  • Synchronise all systems via NTP so that timestamps from different sources are comparable.
  • Send logs to a central server over TLS rather than unencrypted UDP.
  • Use structured fields in your own applications instead of hiding values in free text.

Read the RFC at the RFC Editor

Search the Web Archive

Found a mistake or have something to add? Get in touch.