The property replacer is a core component in rsyslogd's output system. A syslog message has a number of well-defined properties (see below). Each of this properties can be accessed and manipulated by the property replacer. With it, it is easy to use only part of a property value or manipulate the value, e.g. by converting all characters to lower case.
Syslog message properties are used inside templates. They are accessed by putting them between percent signs. Properties can be modified by the property replacer. The full syntax is as follows:
%propname:fromChar:toChar:options%
propname
is the name of the property to access. It is case-sensitive.
Currently supported are:
msg | the MSG part of the message (aka "the message" ;)) |
rawmsg | the message excactly as it was received from the socket. Should be useful for debugging. |
UxTradMsg | will disappear soon - do NOT use! |
HOSTNAME | hostname from the message |
source | alias for HOSTNAME |
syslogtag | TAG from the message |
PRI | PRI part of the message - undecoded (single value) |
IUT | the monitorware InfoUnitType - used when talking to a MonitorWare backend (also for phpLogCon) |
syslogfacility | the facility from the message - in numerical form |
syslogpriority | the priority (actully severity!) from the message - in numerical form |
timegenerated | timestamp when the message was RECEIVED. Always in high resolution |
timereported | timestamp from the message. Resolution depends on what was provided in the message (in most cases, only seconds) |
TIMESTAMP | alias for timereported |
FromChar
and toChar
are used to build substrings. They specify the offset within
the string that should be copied. Offset counting starts at 1, so if you need to
obtain the first 2 characters of the message text, you can use this syntax:
"%msg:1:2%". If you do not whish to specify from and to, but you want to specify
options, you still need to include the colons. For example, if you would like to
convert the full message text to lower case, use "%msg:::lowercase%".
property options
are case-insensitive. Currently, the following options
are defined:
uppercase | convert property to lowercase only |
lowercase | convert property text to uppercase only |
drop-last-lf | The last LF in the message (if any), is dropped. Especially useful for PIX. |
date-mysql | format as mysql date |
date-rfc3164 | format as RFC 3164 date |
date-rfc3339 | format as RFC 3339 date |
escape-cc | NOT yet implemented |