禁用 Haproxy Logging 消息

Han*_*otc 2 haproxy

我有问题haproxy。每次关闭 virtuoso 时,haproxy 都会显示以下错误消息:

来自 syslogd@master0 的消息于 7 月 9 日 14:39:18 ... haproxy[4403]:后端 virtuoso 没有可用的服务器!

我找到了 他们建议使用的以下链接*.emerg;local2.none  *但我真的不明白它如何提供帮助以及它应该在配置文件中的位置。

如何修改配置文件以隐藏错误消息。


配置文件

#$export HAPROXY=/scratch_globa/HAProxy/haproxy-1.5.12-dist

global
        log /dev/log    local0
        log /dev/log    local1 notice
        user    test
        group   test_1
        maxconn 8890
        daemon

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull

#
#  Listen on *:80 - Send traffic to the backend named "apache"
#
frontend www-http
    bind *:8890
    default_backend virtuoso

#
# Back-end definition.
#
backend virtuoso
    mode http
    balance roundrobin
    server node0 xxx.xxx.x.xxx:8890 check
# 

#############################################
# Start
Run Code Online (Sandbox Code Playgroud)

Gre*_*egL 5

后在你的问题中引用是正确的,你需要告诉rsyslog现在(或系统日志)停止发送local0.emerglocal1.emerg消息到控制台。

您需要将这些行附加到rsyslog.conf,而不是 HAProxy 配置文件。

作为替代方案,您可以更改

global
    log /dev/log    local0
    log /dev/log    local1 notice
Run Code Online (Sandbox Code Playgroud)

global
    log /dev/log    local0 info alert
    log /dev/log    local1 notice alert
Run Code Online (Sandbox Code Playgroud)

这将具有“限制”消息的最大严重性的效果alert,如 HAProxy文档中所述

log <address> [len <length>] <facility> [<level> [<minlevel>]]  

...

<level>    is optional and can be specified to filter outgoing messages. By
           default, all messages are sent. If a level is specified, only
           messages with a severity at least as important as this level
           will be sent. An optional minimum level can be specified. If it
           is set, logs emitted with a more severe level than this one will
           be capped to this level. This is used to avoid sending "emerg"
           messages on all terminals on some default syslog configurations.
           Eight levels are known :
             emerg  alert  crit   err    warning notice info  debug
Run Code Online (Sandbox Code Playgroud)