Configure HaProxy Server Log In Rsyslog On CentOS 7

High Availability is a group of the computer that ensures the availability of backup servers with no down-time. By default, it does not create a log file Linux, you have to configure the Haproxy server log.

It can reduce the load on a single server which means lots of hits are coming on a single server to access any application, website, and other applications on the server. so

Check Out: Configuration Of High Availability (HA)

Configure HaProxy Server Log In Rsyslog :

We can reduce the load on a server by configuring HA to act as a load balancer. It can be configured using Nginx or HA Proxy Server.

Configuration file location ls /etc/haproxy/haproxy.cfg

haproxyStart the Service

As you can see there is no log file for Haproxy

By default, Haproxy does not make any log until you configure it with the Rsyslog server.

Check Out: How To Protect EC2 Instance From Termination of Running instances

Step 1: You can see Haproxy sends the message to Rsyslog on 127.0.0.1 By Default, Rsyslog server does not listen on any address.

Edit this file /etc/rsyslog.conf and uncomment these lines

These will tell Rsyslog server to listen on UDP 514 port for all Ip addresses and optionally you can this line to listen on localhost.

$UDPServerAddress 127.0.0.1

Step 2: Now you will have to make a file under Rsyslog directory

Check Out: Learn Top 12 lsof Commands Example For Files In Linux 8

I have made a file with ha.conf under the directory Rsyslog and add these lines to this file.

Local2.*    /var/log/haproxy.log

haproxy log file linux

Step 3: additional task if you want a separate log file then you can add these lines in ha.conf file which was created under directory /etc/rsyslog.d/ha.conf

local2.=info   /var/log/haproxy-in.log
local2.notice  /var/log/haproxy-stat.log

Step 4: Restart the service of the Rsyslog server and Haproxy.

configure log haproxy

I configured it on the localhost.

haproxy log file linux

Check Out: EFS Mount Issue “Failed To Resolve Server: Name or Service Not Known”

Now check the location there you will see there will be a log file of haproxy.log will be generated.

configure log haproxy

Logfile location Path is /var/log/haproxy.log

That’s it haproxy log file linux

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment