EmergencyEMERGENCY? Get 24/7 Help Now!

HAProxy: Give me some logs on CentOS 6.5!

 | October 3, 2014 |  Posted In: Insight for DBAs, MySQL

PREVIOUS POST
NEXT POST

HAProxy is frequently used as a load-balancer in front of a Galera cluster. While diagnosing an issue with HAProxy configuration, I realized that logging doesn’t work out of the box on CentOS 6.5. Here is a simple recipe to fix the issue.

If you look at the top of /etc/haproxy/haproxy.cfg, you will see something like:

This means that HAProxy will send its messages to rsyslog on 127.0.0.1. But by default, rsyslog doesn’t listen on any address, hence the issue.

Let’s edit /etc/rsyslog.conf and uncomment these lines:

This will make rsyslog listen on UDP port 514 for all IP addresses. Optionally you can limit to 127.0.0.1 by adding:

Now create a /etc/rsyslog.d/haproxy.conf file containing:

You can of course be more specific and create separate log files according to the level of messages:

Then restart rsyslog and see that log files are created:

Now you can start your debugging session!

PREVIOUS POST
NEXT POST
Stephane Combaudon

Stéphane joined Percona in July 2012, after working as a MySQL DBA for leading French companies such as Dailymotion and France Telecom. In real life, he lives in Paris with his wife and their twin daughters. When not in front of a computer or not spending time with his family, he likes playing chess and hiking.

12 Comments

Leave a Reply