Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 down vote accepted

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

Is it?

log 127.0.0.1 local2

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

$ModLoad imudp.so
$UDPServerRun 514

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

sudo sed -i 's/#$ModLoad imudp.so/$ModLoad imudp.so/' /etc/rsyslog.conf; sudo sed -i 's/#$UDPServerRun 514/$UDPServerRun 514/' /etc/rsyslog.conf; sudo service rsyslog restart
share|improve this answer
1  
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: - linuxadminzone.com/… - kvz.io/blog/2010/08/11/haproxy-logging 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

Your Answer

 
discard

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