Bug 485937

Summary: expression-based filters do not seem to work properly
Product: [Fedora] Fedora Reporter: Andrew J. Schorr <aschorr>
Component: rsyslogAssignee: Tomas Heinrich <theinric>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: pvrabec, theinric
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.21.10-2.fc10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-22 00:52:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew J. Schorr 2009-02-17 15:52:58 UTC
Description of problem:
I am trying to port a syslog-ng configuration to rsyslog.
I believe, however, that there are bugs in the filter expression evaluator
in rsyslog that makes it impossible to port the configuration successfully.
I opened a discussion thread on this in rsyslog forum here:
http://kb.monitorware.com/expression-based-filter-troubles-with-3-21-9-t8924.html


Version-Release number of selected component (if applicable):
3.21.9

How reproducible:
Install rsyslog.conf including a section like this:

$template CronFormat,"%timereported% %HOSTNAME% %syslogtag% [cronrule %syslogseverity-text% %syslogseverity%]%msg:::sp-if-no-1st-sp%%msg%\n"

if ($syslogfacility-text == 'cron') and ($syslogseverity <= 4) \
  then /var/log/bug;CronFormat

Run rsyslog and note that you get entries like this:

bash-3.2$ cat /var/log/bug
Feb 17 10:50:01 ti82 CROND[31805]: [cronrule info 6] (root) CMD (/usr/lib/sa/sa1 -d 1 1)

This entry should not be there, since the severity (6) is not <= 4.


Steps to Reproduce:
1. Install /etc/rsyslog.conf with a filter expression similar to above
2. Run rsyslog
3. Observe that it does not filter properly.
  
Actual results:
Incorrect entries in /var/log/bug

Expected results:
The /var/log/bug file should be empty in the normal case (for info messages
about jobs that cron is running).

Additional info:

Comment 1 Tomas Heinrich 2009-03-13 22:47:40 UTC
There's a bug in the expression processing that breaks variables' conversion.
A current workaround is to use something like
  ($syslogseverity <= '4')
instead of
  ($syslogseverity <= 4)

This should soon be fixed in an updated package.
Thanks for the report.

Comment 2 Fedora Update System 2009-03-31 13:33:58 UTC
rsyslog-3.21.10-2.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/rsyslog-3.21.10-2.fc10

Comment 3 Fedora Update System 2009-04-02 17:12:37 UTC
rsyslog-3.21.10-2.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update rsyslog'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-3190

Comment 4 Fedora Update System 2009-04-22 00:52:26 UTC
rsyslog-3.21.10-2.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.