maas-syslog fix: eliminate duplicate messages

A recent change[0] to allow customization of the log level inadvertently
resulted in most messages being logged twice - once if they matched the
severity constraint, and again for all non-local messages, which for the
intended use case is all of them.

This change corrects the rsyslog.conf to drop local messages, and log
the remainder at the configured severity level. It also removes the
"$RepeatedMsgReduction on" parameter, which may have partially masked
the issue, and whose use is not advised.[1]

Change-Id: Ib15f82d9e1c7cef7d6085d6a215354b064aa09bb
0: e22afb6e95
1: https://www.rsyslog.com/doc/v8-stable/configuration/action/rsconf1_repeatedmsgreduction.html
This commit is contained in:
Phil Sphicas 2020-05-30 05:01:54 +00:00
parent 8f35260091
commit 44c68d4d65
1 changed files with 4 additions and 10 deletions

View File

@ -3,15 +3,9 @@ $ModLoad imudp
$UDPServerRun {{ tuple "maas_region" "podport" "region_syslog" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} $UDPServerRun {{ tuple "maas_region" "podport" "region_syslog" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
#$ModLoad imtcp # load TCP listener #$ModLoad imtcp # load TCP listener
# Reduce message repetition # Discard messages from localhost
$RepeatedMsgReduction on :fromhost-ip, isequal, "127.0.0.1" ~
# Overwrite default when log_level is set # Log remote messages, based on the configured log level
{{- if .Values.conf.syslog.log_level }} *.{{ .Values.conf.syslog.log_level | default "*" }} {{ .Values.conf.syslog.logpath }}/{{ .Values.conf.syslog.logfile }}
*.{{ .Values.conf.syslog.log_level }} {{ .Values.conf.syslog.logpath }}/{{ .Values.conf.syslog.logfile }}
{{- end }}
##$RepeatedMsgContainsOriginalMsg on
:fromhost-ip, !isequal, "127.0.0.1" {{ .Values.conf.syslog.logpath }}/{{ .Values.conf.syslog.logfile }}
& ~ & ~