koflover 发表于 2019-1-1 09:56:53

ubuntu下haproxy日志处理

  1)haproxy配置文件
  log 127.0.0.1 local1 notice
      #此处使用系统的rsyslog来处理日志

  2)rsyslog配置【/etc/rsyslog.conf】
      local0.* /var/log/haproxy.log
      取消如下注释:

      #$ModLoad imudp== 》$ModLoad imudp
      #$UDPServerRun 514 == 》$UDPServerRun 514
  3)核实services文件
      grep 514 /etc/services

      --->显示:【syslog 514/udp】为ok!!!
      --->如果不存在,
      则在/etc/default/rsyslog手动添加:

      RSYSLOGD_OPTIONS="-r -c 5"
      并重启rsyslog服务

  4)配置logrotate
  
  /home/haproxy/log/*.log {
daily
missingok
dateext
rotate 7
compress
delaycompress
create 0640 haproxy adm
notifempty
sharedscripts
postrotate
reload rsyslog >/dev/null 2>&1 || true
endscript
}

  




页: [1]
查看完整版本: ubuntu下haproxy日志处理