centos下haproxy日誌的配置

來源:互聯網
上載者:User

標籤:haproxy 日誌配置

  涉及到的設定檔如下  1)  /etc/haproxy/haproxy.conf  //這個是haproxy程式的主設定檔,具體路徑可以隨意指定,主要是下面這句話       log         localhost   local0  2)  /etc/rsyslog.conf           //這個設定檔不用動,預設會有下面的設定,會讀取 /etc/rsyslog.d/*.conf目錄                                 //下的設定檔    $IncludeConfig /etc/rsyslog.d/*.conf  3)  /etc/rsyslog.d/haproxy.conf //這個檔案是需要我們手動建立的,內容如下: 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 內容如下 # 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"  備忘: #-c 2 使用相容模式,預設是 -c 5 #-r 開啟遠程日誌 #-m 0 標記時間戳記。單位是分鐘,為0時,表示禁用該功能  好了,日誌配置主要就是涉及到這幾個檔案了。    另外,再重啟下rsyslog和haproxy服務就可以了  centos 6: /etc/init.d/rsyslog restart centos 7: systemctl restart rsyslog  killlall -9 haproxy && haproxy -f /etc/haproxy/haproxy.conf   最後,最重要的一點,一定要把iptables udp 514連接埠開起來  iptables -I INPUT -m udp -p udp --dport 514 -j ACCEPT  否則有可能會報一堆錯誤,類似下面這樣子:  sendto logger #0 failed: operation not permitted (errno=1)


centos下haproxy日誌的配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.