I've modified my config to the following:

if $fromhost-ip == "127.0.0.1" then {
   if $syslogfacility == 2 then { action(type="omfile" file="/var/log/maillog") }
   } else {
     action(type="omfile" file="/var/log/maillog-other")
   }
}

It now logs only messages from the local host to /var/log/maillog, but the maillog-other file is not logging messages from the other hosts sending their maillogs to this server. What am I missing?

Does this config properly validate? It seems that you have some unbalanced brackets.

Ah, thanks. Looking at it more closely helped me also realize the logic was wrong. This is what I wanted, and now works properly.

if $fromhost-ip == "127.0.0.1" then {
    #action(type="omfile" file="/var/log/maillog")
if $syslogfacility == 2 then { action(type="omfile" file="/var/log/maillog") }
} else {
if $syslogfacility == 2 then { action(type="omfile" file="/var/log/maillog-other") }
}





_______________________________________________
rsyslog mailing list
https://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