I am trying to pipe the output from a process into syslog using the logger command. Initially I pipe the output into a separate file, but as it happens this filled up the disk when things went wrong. So I figured I redirect the output to syslog and let logrotate deal with the roll-over and archive of the file.
However the following command :
echo "HI" > logger -t test
Resulted in the message appearing twice in /var/log/messages on my CentOS 6 system. I tested it on Gentoo as well where it behaved correctly, only showing a single message.
Any pointers on why CentOS duplicates these messages.
Alex
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On 03/03/2014 09:34 PM, Alexander wrote:
I am trying to pipe the output from a process into syslog using the logger command. Initially I pipe the output into a separate file, but as it happens this filled up the disk when things went wrong. So I figured I redirect the output to syslog and let logrotate deal with the roll-over and archive of the file.
However the following command :
echo "HI" > logger -t test
What are the contents of the file HI in the working directory from which you ran this command?
(I think you mean `echo "HI" | logger -t test`.)
- -- David Benfell see https://parts-unknown.org/node/2 if you don't understand the attachment
Yes, I meant to use the pipe symbol.
-bash-4.1# echo "hi" | logger -t test -bash-4.1# tail messages Mar 4 08:28:36 localhost kernel: imklog 5.8.10, log source = /proc/kmsg started. Mar 4 08:28:36 localhost rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="14128" x-info="http://www.rsyslog.com"] start Mar 4 08:28:52 localhost test: hi Mar 4 08:28:52 localhost test: hi
As you can see all messages are duplicated. I tried this on a clean install of CentOS but was not able to reproduce this problem. Any pointers which might help me debug this issue.
On 04/03/14 13:58, David Benfell wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On 03/03/2014 09:34 PM, Alexander wrote:
I am trying to pipe the output from a process into syslog using the logger command. Initially I pipe the output into a separate file, but as it happens this filled up the disk when things went wrong. So I figured I redirect the output to syslog and let logrotate deal with the roll-over and archive of the file.
However the following command :
echo "HI" > logger -t test
What are the contents of the file HI in the working directory from which you ran this command?
(I think you mean `echo "HI" | logger -t test`.)
David Benfell see https://parts-unknown.org/node/2 if you don't understand the attachment -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCgAGBQJTFWubAAoJEBV64x4SNmArD5kP/0HgMyYUkdrnntdO+zPUf9t6 QrKdGsSPhy2md/AN66B2s2BBk5wYnP3oMPJi+VGDjes8mlLK6hxdfJSVj/hAS+YY saOxTQwe8AlTP3nbbJbzmdER3qJ/wYn6SDMXedQlErgLZ1sl2ZF7dcKvxXLQqPu0 W/Cn1gCymLino6AgH8inCDaqyAeQHS0QVM0a718ajrafACvbZOutbqbqCiv/syQR XzX+gCPmy2lGdLfqEFntLau6A/uH0EMVBnB0qhKf2LeUc+t0uemdURguICeKQiR3 tFEbC+yDunZyj2TpJLl0c+yAPQZvmCjULRqRBvyWbN0Ehkz7PXN+dDO+iT2ECtOw KfHpTMJBwYvkxjFzzAZxQ4QVqcAMqc4XtBRWxeRyqntKwJ2xYCET7cvyUAlt0khO Qjmz17DDR3AVGHpn2LIxmp2pUx8/thfoNMDR477AL51WKrESibIpPhvX5Tk3LpyY GJJhtr5cqYJUZLSYnqXgp3U6ZmO4uA3DwuvCp8kY7/YcLTysx8wj4xl488c4fmfc LTDmBcfL2lAld8BcXHtXkuKFOIkzaBpybDEUnVbigQ5gxkL9bKrK2Ew2W+Wef56D JHiRfXEG5GoxIrQ42ojXew92fIpt47f71Y7VXhmVYaGrumr1C6CYTh2GhlzpbDQa fyzHNPPUulsW4qRSmrF5 =cks2 -----END PGP SIGNATURE-----
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
From: Alexander thahartner@gmail.com
However the following command : echo "HI" > logger -t test Resulted in the message appearing twice in /var/log/messages on my CentOS 6 system.
Tested on CentOS 5.10 32bits/64bits and 6.5 64bits and I only get one appearance... Did you modify /etc/syslog.conf ? Maybe there are two entries repeating the same facility?
JD
On Tue, Mar 4, 2014 at 4:59 AM, John Doe jdmls@yahoo.com wrote:
From: Alexander thahartner@gmail.com
However the following command : echo "HI" > logger -t test Resulted in the message appearing twice in /var/log/messages on my
CentOS 6
system.
I don't get duplicates on a CentOS 6 x86_64 VM of mine.
Either one example (below) will suffice ... obviously eliminating the pipe is probably best. logger "blah" -t test echo "hi" | logger -t test
And it doesn't matter which user I'm logged in as (privileged or non-privileged, it logs things just the same).
Unless of course you wanted to log the contents of a file, then pipe it! ~]# cat /tmp/blah test one test two test three test four
~]# cat /tmp/blah | logger -t test
~]# tail -f /var/log/messages
Tested on CentOS 5.10 32bits/64bits and 6.5 64bits and I only get one appearance... Did you modify /etc/syslog.conf ? Maybe there are two entries repeating the same facility?
The OP is using CentOS 6 which has replaced sysklogd with rsyslog.
JD _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos