How to tell syslog to send custom app's logs to a separate file and NOT into /var/log/syslog WITHOUT changing /etc/syslog-ng/syslog-ng.conf ?
I have a custom application that sends messages to syslog's local3 facility. As each message sent by this app begins with "[myapp]", I wrote this configuration to log into a separate file:
Content of /etc/syslog-ng/conf.d/myapp.conf:
filter f_myapp { facility(local3) and match("[myapp]"); };
destination d_myapp {
file("/var/log/myapp/myapp.log" create_dirs(yes));
};
log {
source(s_src);
filter(f_myapp);
destination(d_myapp);
};
And it works well: messages are going into /var/log/myapp/myapp.log
BUT, they also go to /var/log/syslog and /var/log/messages
To avoid that, we can edit /etc/syslog-ng/syslog-ng.conf and add "and not filter(f_myapp)" to filter f_messages {...} and filter f_syslog3 {...}
OK, but this is a manual task. Lets say that we want to automate logging configurations for many applications...
Is there any way to do that sort of exclusion without changing anything in /etc/syslog-ng/syslog-ng.conf, only using /etc/syslog-ng/conf.d/ ?