ubuntu haproxy 日誌 日誌切割

五:haproxy日誌
1.在/etc/rsyslog.conf中:
添加haproxy日誌路徑:
  local0.* /var/log/haproxy.log 
  local3.* /var/log/haproxy.log
取消註釋:
  #$ModLoad imudp  ==》$ModLoad imudp
  #$UDPServerRun 514 ==》$UDPServerRun 514
重啓rsyslog服務
  service rsyslog restart
 
2.覈實services文件
  grep 514 /etc/services
顯示:
  syslog 514/udp    爲ok!!!
如不存在,手動添加:
  vi /etc/default/rsyslog
  RSYSLOGD_OPTIONS="-r -c 5"
重啓syslog服務,
  service rsyslog restart





Don't forget to tweak the debug level in /etc/haproxy/haproxy.cfg, and maybe set up a logrotate right away in /etc/logrotate.d/haproxy:

/var/log/haproxy*.log
{
    rotate 4
    weekly
    missingok
    notifempty
    compress
    delaycompress
    sharedscripts
    postrotate
        reload rsyslog >/dev/null 2>&1 || true
    endscript
}

發佈了165 篇原創文章 · 獲贊 18 · 訪問量 99萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章