On Sat, 12 Apr 2014, Markus Kont wrote:

Hello,

I was wondering if it is possible to create filter definition within
rsyslog 7 or 8 that could later be invoked (similar to syslog-ng filters)?

For example, if I create this configuration then first line of both
filters are actually redundant. Would it be possible to define
$syslogtag and priority separately and then combine them. Documentation
leaves an impression that this can not be done.

if $syslogtag contains 'apache' \
and $syslogpriority == 3 then /var/log/apache2/syslog-error.log
if $syslogtag contains 'apache' \
and $syslogpriority != 3 then /var/log/apache2/syslog-access.log

I am not trying to achieve anything specific here, just trying to
understand Rsyslog functionality as part of a research :)

we don't have reusable filters, but we do have rulesets, and we do have action blocks that can contain additional filters.

I think that between them these probably will allow you to do what you want.

As Rainer says, in this case

if $syslogtag contains 'apache' {
  if $syslogpriority == 3 then /var/log/apache2/syslog-error.log
    else /var/log/apache2/syslog-access.log
}

is better than reusing filters anyway.

David Lang
_______________________________________________
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