Configure haproxy logs in centos

Source: Internet
Author: User

Configure haproxy logs in centos

The configuration file involved is as follows: 1)/etc/haproxy. conf // This is the main configuration file of the haproxy program. The specific path can be specified at will, mainly in the following sentence: loglocalhostlocal02)/etc/rsyslog. conf // This configuration file does not need to be moved. By default, the following settings will be used to read/etc/rsyslog. d /*. configuration File $ IncludeConfig/etc/rsyslog under the conf directory. d /*. conf3)/etc/rsyslog. d/haproxy. conf // This file needs to be created manually. The content is as follows: cat/etc/rsyslog. d/haproxy. conf $ ModLoadimudp $ UDPServerRun514 $ templateHaproxy, "% rawmsg % \ n" local0.= info-/var/log/haproxy. log; Haproxylocal0.notice-/v Ar/log/haproxy-status.log; Haproxy ### keeplogsinlocalhost ## local0 .*~ 4)/etc/sysconfig/rsyslog content is as follows # Optionsforrsyslogd # feature # Ifyouwanttousethem, role "-c2" # Seersyslogd (8) formoredetailsSYSLOGD_OPTIONS = "-c2-r-m0" Remarks: #-c2 adopts the compatibility mode. The default value is-c5 #-r to enable remote logs #-m0 to mark the timestamp. The Unit is minute. If it is 0, this function is disabled. The log configuration mainly involves these files. In addition, restart the rsyslog and haproxy services to enable centos6:/etc/init. d/rsyslogrestartcentos7: systemctlrestartrsyslogkilllall-9haproxy & haproxy-f/etc/haproxy. conf Finally, the most important point, be sure to open the iptablesudp514 port iptables-IINPUT-mudp-pudp -- dport514-jACCEPT otherwise there may be a bunch of errors, like the following: sendtologger #0 failed: operationnotpermitted (errno = 1)

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.