O uso de & ~
foi preterido na v7 do rsyslogd e você é incentivado a usar & stop
. Você pode ler mais sobre isso nesta seção da página de compatibilidade com v7 .
omruleset and discard (~) action are deprecated
Both continue to work, but have been replaced by better alternatives.
The discard action (tilde character) has been replaced by the “stop”
RainerScript directive. It is considered more intuitive and offers
slightly better performance.
The omruleset module has been replaced by the “call” RainerScript
directive. Call permits to execute a ruleset like a subroutine, and
does so with much higher performance than omruleset did. Note that
omruleset could be run off an async queue. This was more a side than a
desired effect and is not supported by the call statement. If that
effect was needed, it can simply be simulated by running the called
rulesets actions asynchronously (what in any case is the right way to
handle this).
Note that the deprecated modules emit warning messages when being
used. They tell that the construct is deprecated and which statement
is to be used as replacement. This does not affect operations: both
modules are still fully operational and will not be removed in the v7
timeframe.
Então, para o HAProxy, algo assim:
$ more /etc/rsyslog.d/haproxy.conf
local2.* /var/log/haproxy.log
& stop
Como funciona, o & stop
diz ao rsyslogd para descartar qualquer mensagem adicional que corresponda às regras previamente correspondidas até este ponto. Para garantir que esta regra seja atendida antecipadamente, você pode alterar o nome do arquivo de /etc/rsyslog.d/haproxy.conf
para /etc/rsyslog.d/00-haproxy.conf
.