Red Hat Bugzilla – Bug 820996
rsyslog writes debug messages to fd 1 even after forking
Last modified: 2012-06-20 02:59:11 EDT
Description of problem: The rsyslog does not send messages to the remote site if running with "-d", btw "-dn" is ok. Version-Release number of selected component (if applicable): rsyslog-5.8.10-1.el6 How reproducible: always Steps to Reproduce: on server: 1. # cat >> /etc/rsyslog.conf <<EOF \$ModLoad imtcp.so \$InputTCPServerRun 514 local2.error /var/log/test-rsyslog.log EOF # service rsyslog restart on client: 2. # cat >> /etc/rsyslog.conf <<EOF local2.error @@$SERVERS EOF 3. # /sbin/rsyslogd -d 4. # logger -p local2.error 'communication test' on server: 5. # grep 'communication test' /var/log/test-rsyslog.log Actual results: grep does not find the message Expected results: grep does find the message
Actually, the issue is not limited to forwarding messages. If debugging is turned on, the messages are written to stdout (fd 1). When the daemon forks, stdout is closed and something else can be opened as fd 1 (file / socket / ...). The target gets cluttered by debug messages which possibly exceed the maximum line length which in turn causes message loss. steps to reproduce: - first action in rsyslog.conf *.* /tmp/all.log - from shell run rsyslogd -c 5 -d - debug messages (besides syslog messages) end up in all.log
Created attachment 584922 [details] proposed patch
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Previous version of rsyslog attempted to write debugging messages to standard output even when run in background. This resulted in the debugging information being written to some other output. This was corrected and the debug messages are not written to standard output when run in background.
Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1 +1,3 @@ -Previous version of rsyslog attempted to write debugging messages to standard output even when run in background. This resulted in the debugging information being written to some other output. This was corrected and the debug messages are not written to standard output when run in background.+Previous version of rsyslog attempted to write debugging messages to standard output even when run in background. +This resulted in the debugging information being written to some other output. This was corrected and the debug messages are not +written to standard output when run in background.
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/RHSA-2012-0796.html