I have rules such as:
if $hostname startswith 'd.42ba7373' and $programname == 'app' then /var/log/applog
and don't want to output messages that go into that log to /var/log/syslog as well. Is that possible?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityThe discard (~
) action may help.http://www.rsyslog.com/doc/rsyslog_conf_actions.html
if $hostname startswith 'd.42ba7373' and $programname == 'app' then /var/log/applog
if $hostname startswith 'd.42ba7373' and $programname == 'app' then ~
/var/log/remotes/%HOSTNAME%/syslog.log
for remotes, but /var/log/syslog
if it's from the master. I'm happy to hard-code the FQDN of the master in the config file todo this, but I can't figure out the conditionals.
A similar issue is here. The above answer is going to work perfectly if the drop action is done in the main rsyslog conf file, which in case of ubuntu 14.04 with rsyslog 7.4.4 is /etc/rsyslog.conf
. If anyone is using a separate conf file altogether, it should be named such that it comes before 50-default.conf
filename in the dictionary order, because the 50-default.conf file contains config for putting the logs to /var/log/syslog
.
$template FILENAME,"/var/log/remotes/%HOSTNAME%/syslog.log"
*.* ?FILENAME