What are Syslog formats?

Better Stack Team
Updated on August 25, 2023

Syslog is a standard protocol for logging and sending messages between network devices, including servers, routers, switches, and other networking equipment. Syslog messages typically contain information about various events, status updates, and errors. The syslog protocol is defined in RFC 5424, and it allows for different message formats.

The syslog message format consists of several fields, including the facility, severity level, timestamp, hostname, application name, process ID, and the actual message. The message format can vary depending on the syslog implementation and the version being used. Here are some common syslog message formats:

1. Legacy Syslog Format

 
<PRI>MMM DD hh:mm:ss HOSTNAME TAG: MESSAGE
  • <PRI>: The priority field, combining the facility and severity level.
  • MMM: The three-letter abbreviation for the month.
  • DD: The day of the month.
  • hh:mm:ss: The time in hours, minutes, and seconds.
  • HOSTNAME: The hostname or IP address of the device generating the message.
  • TAG: An arbitrary identifier for the application or process generating the message.
  • MESSAGE: The actual log message.

2. RFC 3164 Syslog Format

This is a slightly updated version of the legacy format, as defined in RFC 3164.

 
<PRI>MMM DD hh:mm:ss HOSTNAME TAG: MESSAGE

3. RFC 5424 Syslog Format

This is the modern format defined in RFC 5424, providing more structured and standardized data for syslog messages.

 
<PRI>VERSION TIMESTAMP HOSTNAME APP-NAME PROCID MSGID [STRUCTURED-DATA] MESSAGE
  • <PRI>: The priority field, combining the facility and severity level.
  • VERSION: The version of the syslog protocol (e.g., 1 for RFC 3164, 1 or 2 for RFC 5424).
  • TIMESTAMP: The timestamp of the event in the format YYYY-MM-DDThh:mm:ss.sssZ.
  • HOSTNAME: The hostname or IP address of the device generating the message.
  • APP-NAME: The name of the application or process generating the message.
  • PROCID: The process ID associated with the application or process.
  • MSGID: The ID to identify the type of message (e.g., "ID12345" for specific events).
  • [STRUCTURED-DATA]: Optional structured data containing additional information in key-value pairs.
  • MESSAGE: The actual log message.

It's worth noting that while the above formats are common, some systems may implement variations or custom formats based on their specific needs. When configuring logging in your applications, it's essential to consider the syslog format supported by your logging library or syslog server.

To learn more about logging, visit Better Stack Community.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github