大网数据广告活动
服务器运维问答

What is the meaning of these HAProxy configuration lines?

· 52CE 我爱测

I've seen several examples (see below) of HAProxy logging configuration that all look like this: /etc/haproxy/haproxy.cfg global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy ... If I understand correctly…

问题原文

原帖链接 · augurar · CC BY-SA 4.0

I've seen several examples (see below) of HAProxy logging configuration that all look like this:

/etc/haproxy/haproxy.cfg

global
    log /dev/log        local0
    log /dev/log        local1 notice
    chroot /var/lib/haproxy
    ...

If I understand correctly this will send logs to /dev/log with facility local0 and for level notice and above, send the same logs with facility local1. What is the purpose of this duplication?


Examples of this configuration in the wild:

已采纳解答

原帖链接 · krisFR · CC BY-SA 4.0

As you stated, at first sight this configuration does not make a lot of sense.

So that i cannot find any official haproxy documentation that suggests this config.

It looks more like a sample config you have to customize, according to your needs, showing how you can use different facilities/syslog server based on levels.

From doc :

  • Connections are logged at level "info"
  • Level "notice" will be used to indicate a server going up
  • "warning" will be used for termination signals and definitive service termination
  • "alert" will be used for when a server goes down

With the config you provide, the advantage is that you will not miss any logs (local0), but you can, at first, focus on logs that directly involve service or server events using local1 as a filter for your syslog server.

Then, with further looking at local0 logs, you can fine tune your filter for your alert system according to your requirement.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-10-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。