Forum Discussion
Customizing syslog-ng f_local0 filter
This is for v10.1.0.
I have developed an iRule that provides us with some useful troubleshooting information by sending useful events to a custom log file. Syslog-ng was set up to capture these events based on a custom syslog-ng filter I added using the "b syslog include" statement which looks for a custom string pattern. This all works fine and good. The issue I've got is that because of the default f_local0 filter, these log messages are also being sent to the /var/log/ltm file. I want to isolate these logging events to my custom log file by adding an exclusion statement in the f_local0 filter. However the top of the syslog-ng.conf file warns against editing the file directly, and the bigpipe syslog command doesn't seem to provide any way to customize built-in filters. Is there another way to customize the default syslog-ng filters using the bigpipe syslog command?
- hoolio
Cirrostratus
Hi SMP, - smp_86112
Cirrostratus
Hi Hoolio, - hoolio
Cirrostratus
That's what I got from the article as well. If I remember correctly... If you try to define an object which already exists in the default syslog-ng config using an include file, it just redefines the object (and does not modify the previously defined object). - smp_86112
Cirrostratus
"...and overrides the default object definitions, since the include statement is the last one to load." That's a critical piece that's missing in the doc, in my opinion. My testing today confirmed my suspicion - the "bigpipe syslog include" command overrides everything else. Here's the syslog-ng customization I developed to send a subset of log entries to a custom log file. In my logging iRule, I simply need to add a "" custom string to the log output. I chose to match the string ": " instead of just "" in the f_local0 filter because it was capturing AUDIT logging events in the /var/log/customlog every time I modified the iRule.
Logging iRule Definition
Syslog-ng Includewhen CLIENT_ACCEPTED { log local0. "this goes to /var/log/ltm" log local0. "this goes to /var/log/customlog" }
b syslog include '" filter f_local0 { facility(local0) and not match(\": \"); }; filter f_local0_customlog { facility(local0) and match(\": \"); }; destination d_customlog { file(\"/var/log/customlog\" create_dirs(yes)); }; log { source(local); filter(f_local0_customlog); destination(d_customlog); }; "'
- hoolio
Cirrostratus
That's a novel approach with the two hashes for differentiating the custom iRule logging from standard logging.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com