in.tftpd stops logging after rsyslogd is HUP'd or restarted
Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- xinetd + in.tftpd + rsyslog
Issue
-
When rsyslog3 (RHEL5) or rsyslog4 (early RHEL6) is HUP'd (that is, when you do a
service rsyslog reloadorkillall -HUP rsyslogd) or restarted (service rsyslog restart), it stops receiving log entries from any of xinetd's already-running in.tftpd instances. -
Note that this can be reproduced with rsyslog on either RHEL 5 or 6, but not on RHEL5 with old vanilla syslog.
Resolution
-
On HUP
To avoid this issue whenrsyslogdreceives a HUP signal, do one of the following:-
Update to rsyslog v5 (
rsyslog5rpm in RHEL5; in RHEL6 thersyslogpackage was rebased) which has a much leaner reload behavior -- the/dev/logsocket is no longer recreated on receipt of HUP -
Stop using HUP
In all seriousness, the most common cause ofrsyslogdgetting a HUP is logrotate
To avoid this, one could add thecopytruncatedirective to all logrotate config stanzas which apply to files that rsyslog touches ... and then of course comment out or disable the HUP logic as well
This approach is not recommended as logs can be lost -- i.e., any logs which rsyslog writes to a file while logrotate is doing the copy (seeman logrotatedescription forcopytruncate)
-
-
On full restart
To avoid this issue whenrsyslogdis restarted, there are a couple options:-
Update to RHEL 7
This issue will not be seen in RHEL7 since systemd (specifically,systemd-journald.socketis responsible for the creation of/dev/log -
Update to rsyslog v7 (not available in RHEL5;
rsyslog7rpm in RHEL6) and change the$ModLoad imuxsockline inrsyslog.conftomodule(load="imuxsock" SysSock.Unlink="off")1
-
Diagnostic Steps
To reproduce:
-
Add the following (set instance timeout to 200s and increase verbosity) to the server_args line in /etc/xinetd.d/tftp and start/reload xinetd
-t 200 -v -
Ensure you have a couple files in your tftpboot dir and then do a
tail -f /var/log/messages | grep tftp -
on the client: Use
tftp SERVER -c get fileto download a file or two, ensuring you see something like the following in the server's logJun 10 18:24:21 58-up in.tftpd[22611]: RRQ from 192.168.122.22 filename file1 Jun 10 18:24:30 58-up in.tftpd[22611]: RRQ from 192.168.122.22 filename file2 -
on the server: Do a
killall -HUP rsyslogdor aservice rsyslog reload -
on the client: Use
tftpon the client again to get the files and you should notice that the log events do not appear on the server like before
The same buggy behavior cannot be reproduced with classic syslog in RHEL5.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
