Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have configured rsyslog (CentOS 6.3) adding the -c 0 -r options and the line

local2.* /var/log/haproxy.log 

and restarted rsyslog but all that happens is an haproxy.log gets created. It is never written to.

Not quite sure how to troubleshoot this.

Below is my haproxy.cfg file. Nothing else is configured to use local2 according to grepping for it in rsyslog.conf. My haproxy config is basically the default, just trying to get logging working first.

share|improve this question
Please reformat your question so that it is readable. – daff Mar 18 '13 at 18:01
up vote 6 down vote accepted

I believe haproxy only have syslog logging via UDP. What is your log config line in haproxy.cfg?

Is it?

log local2

If so, you'll need to enable the UDP server modules in the rsyslog configuration by uncommenting:

$UDPServerRun 514

Tip: I run the following command on all my haproxy servers:

sudo sed -i 's/#$ModLoad$ModLoad' /etc/rsyslog.conf; sudo sed -i 's/#$UDPServerRun 514/$UDPServerRun 514/' /etc/rsyslog.conf; sudo service rsyslog restart
share|improve this answer
I love you! Thank you so much! – user160910 Mar 18 '13 at 19:17
Just out of curiosity, for a dummy like me, who doesn't know that.. How would you recommend troubleshooting an issue like that? How could I have seen that the UDP logging info was being blocked (aside from reading the rsyslog man pages)? – user160910 Mar 18 '13 at 19:20
It was a while back for this problem (over a year ago), and I believe I solved it after reading one or some of the following: -… - Definitely read and re-read the haproxy config and rsyslog man pages. Knowing that it's UDP to syslog logging from haproxy manual, I would have done a tcpdump to find who's at fault (whether haproxy or rsyslog) and go from there. Command would be: tcpdump -i lo udp port 514 – Martin L. Mar 18 '13 at 21:26
seems relevant:… – Erik Allik Oct 12 '14 at 22:48
thanks! this worked for me in my EC2 Amazon Linux – olleh Nov 26 '15 at 4:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.