# IETF-syslog messages

This section describes the format of a syslog message, according to the [IETF-syslog protocol](<https://tools.ietf.org/html/rfc5424>). A syslog message consists of the following parts:

  * `HEADER` (includes the `PRI` as well)
  * `STRUCTURED-DATA`
  * `MSG`



The following is a sample syslog message (source: <https://tools.ietf.org/html/rfc5424)>:

Terminal window
```
    <34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8
```

The message corresponds to the following format:

Terminal window
```
    <priority>VERSION ISOTIMESTAMP HOSTNAME APPLICATION PID MESSAGEID STRUCTURED-DATA MSG
```

Part | Example  
---|---  
[`PRI`](../../../docs/axosyslog-core/4.26/chapter-concepts/concepts-message-structure/concepts-message-pri/index.md) | `<34>`  
`VERSION` | `1`  
`TIMESTAMP` | `2003-10-11T22:14:15.003Z`  
`HOSTNAME` | `mymachine.example.com`  
`APP-NAME` | `su`  
`PROCID` | `-`  
`MSGID` | `ID47`  
`STRUCTURED-DATA` | `-`  
`MSG` | `'su root' failed for lonvick on /dev/pts/8`  
  
The HEADER part of the message must be in plain ASCII format, the parameter values of the STRUCTURED-DATA part must be in UTF-8, while the MSG part should be in UTF-8. The different parts of the message are explained in the following sections.

Note In RFC 5424, the `PRI` and `VERSION` are mandatory. The remaining `HEADER` fields (`TIMESTAMP`, `HOSTNAME`, `APP-NAME`, `PROCID`, `MSGID`) and the `STRUCTURED-DATA` must be present, but can be the NILVALUE `-` when the sender has no value for them. The `MSG` part is optional. 

## The PRI message part

The `PRI` is calculated and interpreted exactly as in BSD-syslog messages (`facility * 8 + severity`). For the formula and the facility and severity code tables, see [The PRI message part](../../../docs/axosyslog-core/4.26/chapter-concepts/concepts-message-structure/concepts-message-pri/index.md).

## The HEADER message part

The HEADER part contains the following elements:

  * _VERSION_ : Version number of the syslog protocol standard. Currently this can only be `1`.
  * _ISOTIMESTAMP_ : The time when the message was generated in the ISO 8601 compatible standard timestamp format (yyyy-mm-ddThh:mm:ss+-ZONE), for example: `2006-06-13T15:58:00.123+01:00`.
  * _HOSTNAME_ : The machine that originally sent the message.
  * _APPLICATION_ : The device or application that generated the message
  * _PID_ : The process name or process ID of the syslog application that sent the message. It is not necessarily the process ID of the application that generated the message.
  * _MESSAGEID_ : The ID number of the message.



Note The AxoSyslog application supports other timestamp formats as well, like ISO, or the PIX extended format. The timestamp used in the IETF-syslog protocol is derived from RFC3339, which is based on ISO8601. For details, see the `ts-format()` option in [Global options reference](../../../docs/axosyslog-core/4.26/chapter-global-options/reference-options/index.md). 

The AxoSyslog application will truncate the following fields:

  * If _APP-NAME_ is longer than 48 characters it will be truncated to 48 characters.
  * If _PROC-ID_ is longer than 128 characters it will be truncated to 128 characters.
  * If _MSGID_ is longer than 32 characters it will be truncated to 32 characters.
  * If _HOSTNAME_ is longer than 255 characters it will be truncated to 255 characters.



## The STRUCTURED-DATA message part

The STRUCTURED-DATA message part may contain meta-information about the syslog message, or application-specific information such as traffic counters or IP addresses. STRUCTURED-DATA consists of data blocks enclosed in brackets (_[]_). Every block includes the ID of the block, and one or more _name=value_ pairs. The AxoSyslog application automatically parses the STRUCTURED-DATA part of syslog messages, which can be referenced in macros (for details, see [Macros of AxoSyslog](../../../docs/axosyslog-core/4.26/chapter-manipulating-messages/customizing-message-format/reference-macros/index.md)). An example STRUCTURED-DATA block looks like:

Terminal window
```
    [exampleSDID@0 iut="3" eventSource="Application" eventID="1011"][examplePriority@0 class="high"]
```

## The MSG message part

The MSG part contains the text of the message itself. The encoding of the text must be UTF-8 if the BOM

The byte order mark (BOM) is a Unicode character used to signal the byte-order of the message text.

character is present in the message. If the message does not contain the BOM character, the encoding is treated as unknown. Usually messages arriving from legacy sources do not include the BOM character. CRLF characters will not be removed from the message. 

Last modified July 24, 2026: [Add message-parts tables and wire-level examples (41a146ab)](<https://github.com/axoflow/axosyslog-core-docs/commit/41a146ab2ef76cf7606d0af5ba078ec906cc2b9d>)