rsyslog Properties¶
Data items in rsyslog are called “properties”. They can have different origin. The most important ones are those that stem from received messages. But there are also others. Whenever you want to access data items, you need to access the respective property.
Properties are used in
conditional statements
The property name is case-insensitive (prior to 3.17.0, they were case-sensitive).
Note: many users refer to “rsyslog properties” as “rsyslog variables”. You can treat them as synonymous. Read how rsyslog lead author Rainer Gerhards explains the naming difference.
Message Properties¶
These are extracted by rsyslog parsers from the original message. All message properties start with a letter.
The following message properties exist:
Note
Property names are case-insensitive. Use the spelling from headings in prose and examples.
Property |
Summary |
---|---|
Returns the MSG part of the processed syslog message. |
|
Provides the received message exactly as rsyslog stored it. |
|
Contains the raw message content with the syslog PRI removed when present. |
|
Captures the hostname transmitted within the syslog message. |
|
Provides the same hostname value as hostname. |
|
Reports the hostname of the system from which the message was received. |
|
Provides the message source as an IP address just like fromhost. |
|
Reports the numeric source port of the sender in line with fromhost. |
|
Returns the TAG field extracted from the syslog message header. |
|
Extracts the static program name portion from the syslog tag. |
|
Provides the undecoded PRI header value defined by RFC 5424 Section 6.2.1. |
|
Formats the RFC 5424 PRI header as facility.severity with the numeric PRI appended. |
|
Holds the monitorware InfoUnitType value when present. |
|
Contains the numeric syslog facility extracted from the message. |
|
Returns the textual syslog facility defined in RFC 5424 Table 1. |
|
Provides the numeric syslog severity extracted from the message. |
|
Returns the textual syslog severity defined in RFC 5424 Table 2. |
|
Provides the same numeric value as syslogseverity for historical reasons. |
|
Returns the same textual severity string as syslogseverity-text. |
|
Records when rsyslog received the message with high resolution. |
|
Captures the timestamp present in the original message header. |
|
Provides the same value as timereported from the message header. |
|
Carries the VERSION header field defined by RFC 5424 Section 6.2.2. |
|
Provides the STRUCTURED-DATA field defined in RFC 5424 Section 6.3. |
|
Carries the APP-NAME header field defined in RFC 5424 Section 6.2.5. |
|
Carries the PROCID header field defined in RFC 5424 Section 6.2.6. |
|
Carries the MSGID header field defined in RFC 5424 Section 6.2.7. |
|
Identifies the rsyslog input module instance that produced the message. |
|
Exposes a per-message UUID generated on first access when enabled. |
|
Provides the entire message object as a JSON representation. |
System Properties¶
These properties are provided by the rsyslog core engine. They are not related to the message. All system properties start with a dollar-sign.
Special care needs to be taken in regard to time-related system variables:
timereported
contains the timestamp that is contained within the message header. Ideally, it resembles the time when the message was created at the original sender. Depending on how long the message was in the relay chain, this can be quite old.timegenerated
contains the timestamp when the message was received by the local system. Here “received” actually means the point in time when the message was handed over from the OS to rsyslog’s reception buffers, but before any actual processing takes place. This also means a message is “received” before it is placed into any queue. Note that depending on the input, some minimal processing like extraction of the actual message content from the receive buffer can happen. If multiple messages are received via the same receive buffer (a common scenario for example with TCP-based syslog), they bear the sametimegenerated
stamp because they actually were received at the same time.$now
is not from the message. It is the system time when the message is being processed. There is always a small difference betweentimegenerated
and$now
because processing always happens after reception. If the message is sitting inside a queue on the local system, the time difference between the two can be some seconds (e.g. due to a message burst and in-memory queueing) up to several hours in extreme cases where a message is sitting inside a disk queue (e.g. due to a database outage). Thetimereported
property is usually older thantimegenerated
, but may be totally different due to differences in time and time zone configuration between systems.
The following system properties exist:
Property |
Summary |
---|---|
Emits the UTF-8 byte-order mark for use in templates when required. |
|
Returns the local host name as rsyslog knows it. |