]> git.ipfire.org Git - thirdparty/util-linux.git/commit
logger: reconnect on failed send()
authorKarel Zak <kzak@redhat.com>
Tue, 10 Oct 2017 11:56:30 +0000 (13:56 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 10 Oct 2017 11:56:30 +0000 (13:56 +0200)
commitcaf6ac6e596b09615b5f4bffe588ec1268d8c596
tree5ab43467a27165e8d59f4105580e8f575c81eb24
parent55833ba9b2d54f7eac80284cfd7f0ca186a6475c
logger: reconnect on failed send()

The libc syslog() reconnects on failed send(). We need the same thing
as logger(1) is expected as long time running tool. For example
recommended Apache configuration is:

ErrorLog "| /usr/bin/logger -t apache_error -p local6.debug"

The issue is that connection endpoint (e.g. syslogd) maybe restarted.
The simple way how to test is:

for i in $(seq 0 3600); do echo "This is message number $i"; sleep 1; done | logger --tcp --server 127.0.0.1 --port 514

and restart your syslog. The current implementation gets SIGPIPE or
write warning message, but it never reconnect.

Addresses: https://github.com/karelzak/util-linux/issues/363
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/logger.c