]> git.ipfire.org Git - thirdparty/util-linux.git/commit
logger: fix inconsistent format regression when logging locally
authorRainer Gerhards <rgerhards@adiscon.com>
Wed, 4 Mar 2015 10:17:20 +0000 (11:17 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Mar 2015 09:15:57 +0000 (10:15 +0100)
commitd9074f191e4a6057f51f3a0d4bd0973366e245e2
treef3d66b5fb6c37bbfd6da7a07a41f7061ab449c13
parent753f2807c9297d4226b7cfe44fd145f9e3e2b40b
logger: fix inconsistent format regression when logging locally

The message format when writing to local sockets is inconsistent. Example:

$ ./logger --stderr test
<5>Mär  4 11:03:30 logger: test
$ ./logger -u /dev/log --stderr test
<5>1 2015-03-04T11:03:31.699841+0100 ubuntu1404esp rger - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="29000"] test

The regression was introduced with 4de2e8a03859aaab2c25dc98f33409cd28de6acc
As far as the commit comments and man page indicates, this was meant to affect
remote system logging only, but it also affects local logging when the -u
option is given.

This causes problems with receivers who do not expect full-blown RFC format
on the log socket, like rsyslog. In consequence, this can also affect
log analysis programs and invalidate some of their results.

The patch corrects the behaviour so that the same old-style format is used for
any type of local logging. New-style can always be selected by command line-options.
RFC5424 is still the default for remote logging, as intended in the orignal
commit.

Result with the patch:
$ ./logger --stderr test
<5>Mär  4 11:15:35 logger: test
$ ./logger -u /dev/log --stderr test
<5>Mär  4 11:15:40 logger: test
$ ./logger -u /dev/log --rfc5424 --stderr test
<5>1 2015-03-04T11:21:28.796170+0100 ubuntu1404esp rger - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="27500"] test
misc-utils/logger.c