I'm trying to setup rsyslog to use the template RSYSLOG_TraditionalFileFormat as the default action template, but for some specific messages i need to use another template. In both cases i need dynaFile.
I'm trying to achieve that with:
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$template dynatemplate, "/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
$template dynatemplate2, "/var/log/%HOSTNAME%/%hostname%_%fromhost-ip%_%syslogtag%.log"
:msg, contains, "sometext" ?dynatemplate2;RSYSLOG_SyslogProtocol23Format
& ~
*.* ?dynatemplate
Would the above be considered the correct way?
Also since I'm using rsyslog 8.24 how could it be done using the expression syntax?