An administrator might want to configure logging of the HAProxy service to aid in monitoring and troubleshooting an environment.

The HAProxy logger allows for the use rsyslog internally on the Linux installation to log to a local file. You can also use the VMware Aria Operations for Log integration to send this log to a VMware Aria Operations for Log deployment by utilizing the new Operations for Logs Linux agent to greatly simplify the configuration and logging of Linux platforms. To configure basic applications logging using rsyslog locally on the server perform the following steps.

Procedure

  1. Configure the rsyslog configuration file to accept UDP syslog reception:
    vi /etc/rsyslog.conf
  2. Uncomment the following lines:
    # Provides UDP syslog reception
    $ModLoad imudp
    $UDPServerAddress 127.0.0.1
    $UDPServerRun 514
  3. Save the file:
    wq!
  4. Create the HAProxy logging configuration file for specific application parameters
    vi /etc/rsyslog.d/haproxy.conf
  5. Add the following line:
    if ($programname == 'haproxy') then -/var/log/haproxy.log
  6. Save the file:
    wq!
  7. Create HAProxy Log file and set proper permissions:
    touch /var/log/haproxy.log
    chmod 755 /var/log/haproxy.log
  8. Restart the rsyslog service:
    Service rsyslog restart