-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logger time and connection issues #363
Comments
Yes, the issue with timestamp has been fixed by commit 7db029e. It's definitely better to use v2.28 than v2.26. The issue with connection seems painful, but I need more information. Can you try strace the logger? Did you try another setup (--tcp / --udp, --server, etc)? What about --socket-errors=on. Anyway, this works for me: /etc/syslog-ng/syslog-ng.conf:
and command line:
the log file:
And it also works with --rfc3164 if you like the old style. |
Note that the default port is "syslog-conn", I use --port to be sure in my examples. The syslog version from the example above is syslog-ng-3.6.2-5.fc24.x86_64 |
Commands like this echo "This is my logger message" | ./logger --tcp --server 127.0.0.1 --port 514 work without any problem; but the issue appears when I use logger from inside another program like apache or with the log4j library... |
We're seeing this error as well. We have rsyslog running in different docker container, unix socket is linked between container like bellow. The issue happened only when we restart rsyslog container, however when I send log from inside the container
Our setuprsyslog:
NOTE: rsyslog unix socket is configured to different path on above container apache:
entrypoint.sh:
Apache logging config:
StraceHere is our strace output:
|
Any clue why this is happening? Seems I'm not the only one... |
I can reproduce this pretty easily with util-linux-2.29.2:
|
Found the offending commit (1d57503) using
Seems like in that commit the code no longer uses the |
We are having the exact same problem with using logger from within Apache 2.2. Apache uses piped logging and writes access and error logs line by line to the started logger binary. When rsyslog is restarted (CentOS 6), the logger loses the connection to the unix socket and logging from Apache stops. Apache uses reliable logging, which means that the logging process is restarted on failure. But as the logger does not fail as such (the process does not stop) and only writes errors to the console, Apache has no information that the logger has failed. It seems that stopping the logger would be appropriate, as the error seems unrecoverable - maybe the behaviour could be made configurable with a command line option (--stop-on-failure or similar). Apache would then be able to restart the logger correctly. Another option would be for the logger to try to reestablish the connection to the unix socket when the connection is lost. |
I see the issue. The glibc syslog() re-connect on failed send(). I'll implement the same for logger. Sorry for the delay. |
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: #363 Signed-off-by: Karel Zak <kzak@redhat.com>
The problem should be fixed in the master branch (and will be in v2.31; next week). It would be nice if you can test it in your environment before the release, just
... and use the "logger" binary. Thanks (and again sorry for the delay). |
And also commit e92d55e is relevant for this issue. |
I tested the described issue with a new logger binary, it works as intended. If a Apache is running with a pipe to logger is and syslog is restarted, it continues to log correctly. It can easily reproduced on the command line:
The last test works with the new logger and fails with the old one. |
@vernade what do you mean under "old one"? Which version? And what do you mean under "new logger" as well? |
The "old logger" is: logger from util-linux 2.30 |
Since version 2.26.2, we have troubles using logger in conjunction with other software, e.g. Apache 2.4 or Java-bases software using log4j syslog forwarder, to send logs to syslog-ng using logger via a pipe (as recommended in Apache HTTPD documentation).
As soon as your syslog-ng (3.7) gets restarted, no messages can be delivered via logger to syslog anymore, and I get errors like the following (in my Apache error_log file):
logger: write failed: Connection refused
logger: write failed: Transport endpoint is not connected
logger: write failed: Transport endpoint is not connected
logger: write failed: Transport endpoint is not connected
logger: write failed: Transport endpoint is not connected
logger: write failed: Transport endpoint is not connected
Our Java-baased application hanged up completely sometimes.
There is also an other isse in that the time of the log-message does not get updated. In the logfiles written by syslog, the timestamp is always the time at which the application which uses logger has been started.
Replacing the binary of logger with an older one (e.g. from 2.25.2) solves these issues.
Operating system: Gentoo Linux 64-bit
Version 2.28.2 solves the isse with the timestamps, but the issue with the connection is not resolved with the latest stable version...
The text was updated successfully, but these errors were encountered: