haproxy开启日志功能!

服务端:

修改配置文件:

[root@localhost /]# vim /etc/rsyslog.conf
    ......
	$ModLoad imudp
	$UDPServerRun 514
	$ModLoad imtcp
	$InputTCPServerRun 514
    .......
local2.*                                                /var/log/haproxy.log

    ......

取消TCP、UDP的四个注释,再添加一行,用来记录日志的启动级别、日志的位置。

重启一下服务:

[root@localhost ~]# systemctl restart rsyslog.service
[root@localhost ~]# systemctl restart haproxy

客户端测试

[root@localhost /]# while true;do curl http://172.18.252.121/;sleep .5;done

服务端日志

[root@localhost ~]# tail -f /var/log/haproxy.log

如果出现问题,请参考鄙人上一篇博客:https://blog.csdn.net/qq_34208467/article/details/84032105

猜你喜欢

转载自blog.csdn.net/qq_34208467/article/details/84033201