Is it possible to configure omfwd action with template name chosen by variable?

Want to use different template according the hostname value
(simplified example):

$template fwdrelay1,"<%PRI%>%TIMESTAMP:::date-rfc3339%
%fromhost-ip%-%hostname% %syslogtag%%msg:::drop-last-lf%\n"
$template fwdrelay2,"<%PRI%>%TIMESTAMP:::date-rfc3339% %fromhost-ip%
%syslogtag%%msg:::drop-last-lf%\n"

if ( $hostname == '127.0.0.1' ) then $.tmpl="fwdrelay1"
else $.tmpl="fwdrelay2"
*.* action (type="omfwd" template=tmpl target=.... protocol=tcp)

Peter
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to