Configure Haproxy log support (rsyslog log Support)

Source: Internet
Author: User
Tags haproxy rsyslog

Configure Haproxy log support (rsyslog log Support)

System CentOS 6.x

Configure Haproxy log support

Cp/etc/rsyslog. conf/etc/rsyslog. conf 'date + % F'
Ll/etc/rsyslog. con *
Cat>/etc/rsyslog. conf <EOF
# Haproxy
Local0. */application/haproxy/logs/haproxy. log
# End
EOF

# Local0 should be specified in the haproxy configuration file, so select local0 here. The configuration of the following haproxy configuration file:

====================

Log 127.0.0.1: 514 local0 warning

# Global log configuration, log keyword, specify the local0 log Device in the syslog service using 127.0.0.1: 514, log level, Here select warning, generally do not use info

======================

# Modify/etc/sysconfig/rsyslog as follows:

[Root @ MASTER ~] # Tail-2/etc/sysconfig/rsyslog
# SYSLOGD_OPTIONS = "-c 5"
SYSLOGD_OPTIONS = "-c 2-m 0-r-x"
[Root @ MASTER ~] #

# Restart/etc/init. d/rsyslog

/Etc/init. d/rsyslog restart

#6.4 no port by default

Netstat-lntup
/Etc/init. d/rsyslog restart

######## Modify rsyslog. conf to display the port

Egrep 'udpserverrun | modload'/etc/rsyslog. conf
Sed-I's/# $ UDPServerRun 514/$ UDPServerRun 514/G'/etc/rsyslog. conf
Sed-I's/# $ ModLoad imudp/G'/etc/rsyslog. conf
Sed-n-e '/$ ModLoad imudp/p'-e'/$ UDPServerRun/P'/etc/rsyslog. conf

# Restart/etc/init. d/rsyslog

/Etc/init. d/rsyslog restart
Netstat-lntup | grep rsyslog

[Root @ MASTER ~] # Netstat-lntup | grep rsyslog
Udp 0 0 0.0.0.0: 514 0.0.0.0: * 5031/rsyslogd
Udp 0 0: 514: * 5031/rsyslogd
[Root @ MASTER ~] #
================================
[Root @ MASTER ~] # Cat/application/haproxy/logs/haproxy. log
Nov 6 10:58:49 127.0.0.1 haproxy [5049]: Stopping proxy test in 0 ms.
Nov 6 10:58:49 127.0.0.1 haproxy [5049]: Proxy test stopped (FE: 0 conns, BE: 0 conns ).
Nov 6 10:58:58 127.0.0.1 haproxy [5055]: Stopping proxy test in 0 ms.
Nov 6 10:58:58 127.0.0.1 haproxy [5055]: Proxy test stopped (FE: 0 conns, BE: 0 conns ).
[Root @ MASTER ~] #

### Note: If you still cannot record the log, disable selinux.

Haproxy + Keepalived build Weblogic high-availability server Load balancer Cluster

Keepalived + HAProxy configure high-availability Load Balancing

Haproxy + Keepalived + Apache configuration notes in CentOS 6.3

Haproxy + KeepAlived WEB Cluster on CentOS 6

Haproxy + Keepalived build high-availability Load Balancing

Configure an HTTP Load balancer using HAProxy

For details about HAproxy, click here
HAproxy: click here

This article permanently updates the link address:

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.