From eb87d6f095cc5e72126d8b7716d217a7d6a5e939 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Thankfully, rsyslog provides message properties for the priority. These are called "PRI", "syslogfacility" and "syslogpriority" (case is important!). They are numerical -values. Starting with rsyslog 1.13.4, there is also a property "PRI-text", which -contains the priority in friendly text format (e.g. "syslog.info"). For the rest +values. Starting with rsyslog 1.13.4, there is also a property "pri-text", which +contains the priority in friendly text format (e.g. "local0.err<133>"). For the rest of this article, I assume that you run version 1.13.4 or higher.
Recording the priority is now a simple matter of adding the respective field to the template. It now looks like this:
-$template TraditionalFormatWithPRI,"%PRI-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n"
+$template TraditionalFormatWithPRI,"%pri-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n"
Now we have the right template - but how to write it to a file? You probably have a line like this in your syslog.conf:
-- cgit