From 44c68d4d65e0ed753cf0e8ca40f984f60f95c423 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Sat, 30 May 2020 05:01:54 +0000 Subject: [PATCH] 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: https://opendev.org/airship/maas/commit/e22afb6e953bd8ab8acaa6ebbc04d72c50cd6fb2 1: https://www.rsyslog.com/doc/v8-stable/configuration/action/rsconf1_repeatedmsgreduction.html --- charts/maas/templates/etc/_rsyslog.conf.tpl | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/charts/maas/templates/etc/_rsyslog.conf.tpl b/charts/maas/templates/etc/_rsyslog.conf.tpl index 37bd367..1e05b0d 100644 --- a/charts/maas/templates/etc/_rsyslog.conf.tpl +++ b/charts/maas/templates/etc/_rsyslog.conf.tpl @@ -3,15 +3,9 @@ $ModLoad imudp $UDPServerRun {{ tuple "maas_region" "podport" "region_syslog" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} #$ModLoad imtcp # load TCP listener -# Reduce message repetition -$RepeatedMsgReduction on +# Discard messages from localhost +:fromhost-ip, isequal, "127.0.0.1" ~ -# Overwrite default when log_level is set -{{- if .Values.conf.syslog.log_level }} -*.{{ .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 }} +# Log remote messages, based on the configured log level +*.{{ .Values.conf.syslog.log_level | default "*" }} {{ .Values.conf.syslog.logpath }}/{{ .Values.conf.syslog.logfile }} & ~