Bug 1020431

Summary: "last message repeated..." message missing if rsyslog is shut down during repetition
Product: Red Hat Enterprise Linux 6 Reporter: Dalibor Pospíšil <dapospis>
Component: rsyslog7Assignee: Tomas Heinrich <theinric>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: low Docs Contact:
Priority: low    
Version: 6.5CC: ksrot, pvrabec
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 07:30:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
fix for the issue none

Description Dalibor Pospíšil 2013-10-17 16:09:39 UTC
Description of problem:
if $RepeatedMsgReduction is on the reduction message is logged to unexpected log.

Version-Release number of selected component (if applicable):
rsyslog-5.8.10-8.el6

How reproducible:
100%

Steps to Reproduce:
1. add to /etc/rsyslog.conf
$RepeatedMsgReduction on
$template mymsg,"%pri% - %pri-text%: %msg%\n"
local2.info /var/log/hostname-test.log;mymsg
*.* /var/log/hostname-test-all.log;mymsg

2. send three same messages using logger -p local2.info 'test'

Actual results:
# cat /var/log/hostname-test.log
150 - local2.info:  test

# cat /var/log/hostname-test-all.log
6 - kern.info: imklog 5.8.10, log source = /proc/kmsg started.
46 - syslog.info"  [origin software="rsyslogd" swVersion="5.8.10" x-pid="19602" x-info="http://www.rsyslog.com"] start
150 - local2.info:  test
150 - local2.info:  last message repeated 2 times
6 - kern.info: Kernel logging (proc) stopped.
46 - syslog.info:  [origin software="rsyslogd" swVersion="5.8.10" x-pid="19602" x-info="http://www.rsyslog.com"] exiting on signal 15.


Expected results:
# cat /var/log/hostname-test.log
150 - local2.info:  test
150 - local2.info:  last message repeated 2 times

Additional info:
this is ok on RHEL-7

Comment 3 Tomas Heinrich 2014-03-20 23:15:52 UTC
Reproduced.
This will be fixed either by the rebase to v7 (bug 869600) or an additional patch.

Comment 5 Tomas Heinrich 2014-06-04 15:22:46 UTC
After further investigation, the actual issue is that the "last message repeated..." status message is completely missing if rsyslog is shut down during this repetition. If a different message is logged, the status message is written as expected.

This bug is present in both v5 and v7, but v7 is very different in several aspects.
In v7, rate limiting and repetition are handled per-process. That means invoking logger multiple times won't trigger a repetition.

The attached patch attempts to fix the missing message and also plugs some memleaks.

Comment 6 Tomas Heinrich 2014-06-04 15:24:06 UTC
Created attachment 902216 [details]
fix for the issue

Comment 7 Tomas Heinrich 2014-06-04 15:28:47 UTC
(In reply to Dalibor Pospíšil from comment #0)
> Additional info:
> this is ok on RHEL-7

The reason for different perception of v7 is that in el7, by default, imjournal is used instead of imuxsock input plugin.

Comment 11 errata-xmlrpc 2014-10-14 07:30:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1540.html