Linux – How to stop syslog from listening to 514 on CentOS 5.8

centoslinuxsyslog

I have a CentOS 5.8 machine (with regular syslog) that for some reason is listening to port 514, even though it is not started with "-r" (to receive remote syslog messages).

# netstat -tulpn | grep 514
udp        0      0 0.0.0.0:514       0.0.0.0:*  2698/syslogd  

Syslog is started with only "-m 0":

ps -ef | grep syslogd
root      2698     1  0 15:55 ?        00:00:00 syslogd -m 0

I have tried starting it with "-m 0 -r", just to check if there was any difference, but there is not.

This machine is a client and should only log to a central log server – it should not be listening itself.

What am I missing?

I just found this: https://bugzilla.redhat.com/show_bug.cgi?id=137205. From the last comment made in 2010, it appears this is a bug from 2004 that has still not been resolved (it has only been 8 years…)

Best Answer

I just did some testing, and while the port is definitely opened by syslogd, it doesn't look like it's actually handling or logging any activity directed to it on UDP 514. You can verify this by sending data with netcat:

topher@nexus:~$ nc -u localhost 514
This is a test.
This is another test.
^C

And then checking the logfile. I tested it on two RHEL5 boxes, and if -r isn't used, it won't actually process the logs.

Update: Another solution (or, really, work-around) that I just thought of would be to install rsyslog (or syslog-ng) as a replacement syslog daemon for the default sysklogd. Neither of these alternate syslog daemons suffer from the bug described above.

rsyslog is the default syslog daemon with RHEL 6.x, and is available as a supported package for RHEL/CentOS 5.2+. rsyslog is under active development (sysklogd is not, and hasn't been for years). rsyslog also supports many advanced features and functionality. As mentioned, with RHEL/CentOS 5.2+, switching from the stock syslogd to rsyslog is as easy as yum install rsyslog.

If you do decide on replacing your syslog daemon, and you want something cleaner and more flexible (in my opinion), Syslog-NG is worth taking a look at. The config file doesn't maintain backwards compatibility with the old syslog.conf (rsyslog does), so it can seem a little complicated at first glance, but for complex or advanced logging setups (especially at a central loghost), Syslog-NG is an excellent choice.

Related Topic