Configuring Haproxy to increase logging capabilities

Source: Internet
Author: User
Tags haproxy rsyslog

Haproxy installed on CentOS 7, the log is not logged by default. You need to do a configuration to log the logs.


1. Create a log file/var/log/haproxy/haproxy.log

Cd/var/logsudo mkdir haproxycd haproxysudo touch haproxy.logsudo chmod a+w haproxy.log


2. Turn on the Rsyslog haproxy logging function

Edit the/etc/rsyslog.conf file to

$ModLoad Imudp$udpserverrun 514

The # before two lines is removed.


In

# Save Boot messages also to boot.loglocal7.*                                                /var/log/boot.log

After adding

# Save Haproxy loglocal0.*                       /var/log/haproxy/haproxy.log


Modify the/etc/sysconfig/rsyslog file to

Syslogd_options= ""
Switch

Syslogd_options= "-r-m 0-c 2"




3. Configure Haproxy

Modify the/etc/haproxy/haproxy.cfg file and add it in the global section

Log         127.0.0.1 local0


Restart the Rsyslog and Haproxy services, and Haproxy will be able to log the logs.











Configuring Haproxy to increase logging capabilities

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.