Configuration of Haproxy logs under CentOS

Source: Internet
Author: User
Tags haproxy rsyslog

   the configuration file involved is as follows   1)   /etc/haproxy/haproxy.conf  //This is the main configuration file for the Haproxy program, The specific path can be arbitrarily specified, mainly the following sentence        log          LOCALHOST   LOCAL0  2)   /etc/rsyslog.conf            //This configuration file does not move, the default will have the following settings, will read the  /etc/rsyslog.d/*.conf directory                      Configuration files under               //      $IncludeConfig  /etc/rsyslog.d/*.conf  3)   /etc/rsyslog.d/haproxy.conf // This file needs to be created manually, as follows: cat /etc/rsyslog.d/haproxy.conf  $ModLoad  imudp  $UDPServerRun  514   $template  haproxy, "%rawmsg% \n"  local0.=info -/var/log/haproxy.log; haproxy local0.notice -/Var/log/haproxy-status.log; HAPROXY ### KEEP LOGS IN LOCALHOST ## LOCAL0.* ~   4)   /etc/sysconfig/rsyslog  content as follows  # OPTIONS FOR RSYSLOGD # SYSLOGD  options are deprecated since rsyslog v3. # if you want  to use them, switch to compatibility mode 2 by  "-c 2"  # SEE RSYSLOGD (8)  for more details syslogd_options= "-c 2 -r  -m 0 "   notes: #-c 2  use compatibility mode, default is  -c 5 #-r  turn on remote log  #-m  0  mark the timestamp. The unit is the minute, which is 0 o'clock, which means disable the function    Well, the log configuration is mainly related to these files.      Also, restart the Rsyslog and Haproxy services to   centos 6: /etc/init.d/rsyslog  Restart centos 7: systemctl restart rsyslog  killlall -9 haproxy  && haproxy -f /etc/haproxy/haproxy.conf    Finally, the most important point, be sure to open the iptables udp 514 port   iptables  -I INPUT -m udp -p udp --dport 514 -j ACCEPT   Otherwise, a bunch of errors may be reported, such as the following:  sendto logger  #0  failed: operation not permitted   (errno=1)


Configuration of Haproxy logs under CentOS

Related Article

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.