ubuntu22.04下haproxy的日志记录到rsyslog配置方法

ubuntu22.04 用apt install haproxy 进行安装后,/etc/haproxy/haproxy.cfg的配置中包含的日志选项: 其中 log /dev/log local0 的意思就是haproxy日志进入到本地日志系统中 (/dev/log).log: 全局的日志配置,local0是日志设备,info 表示日志级别。其中日志级别有 err、warning、info、debug 四种可选。这个配置表示使用 127.0.0.1 上的 rsyslog 服务中的 local0 日志设备,记录日志等级为 info;log 指定收集哪个机器的 log,log 的收集是通过系统工具来实现的,在 centos6 版本之前以 syslog 来收集日志,6版本变为了 rsysylog。这些都是用于收集系统的日志,local0 指定设备,info 表示输出日志的级别,error 级别是在报错的时候才会输出。info 只要有正常信息都会进行输出,生产环境建议设置 为 notice 级别。 安装rsyslog系统,apt install rsyslog,并启动:systemctl start rsyslog, 查看状态: systemctl status rsyslog ,确保没有报错: 编辑 /etc/rsyslog.conf 这个配置文件,在最后加两行: 重启服务: systemctl restart rsyslog 先确保日志文件的权限正确: … Continue reading ubuntu22.04下haproxy的日志记录到rsyslog配置方法