Fix: Fix syslog logging to stdout + fix starting of exporter

This commit is contained in:
Bojan Čekrlić 2023-10-27 15:31:54 +02:00
parent 5a09ee5a45
commit bcf7dcbfcb
2 changed files with 31 additions and 15 deletions

View file

@ -1,5 +1,6 @@
$ModLoad immark.so # provides --MARK-- message capability
$ModLoad immark.so # provides --MARK-- message capability
$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command)
$ModLoad omstdout.so # provide messages to stdout
# default permissions for all log files.
$FileOwner root
@ -45,17 +46,31 @@ template(name="plain" type="list") {
#module(load="mmexternal")
#</email-anonymizer>
# Severity levels are numbered 0 to 7:
#
# 0 emergency (System unusable)
# 1 alert (Immediate action needed)
# 2 critical events (Critical condition)
# 3 error events (Error condition)
# 4 warning events (Warning condition)
# 5 notification events (Normal but significant condition)
# 6 informal events (Informational message only)
# 7 debug messages (Appears during debugging only)
include(file="/etc/rsyslog.d-before/*.conf" mode="optional")
if $syslogseverity <= '6' then {
# Do not log healthchecks
if ($msg contains_i "connect from localhost[127.0.0.1]") then { stop }
if ($msg contains_i "lost connection after EHLO from localhost[127.0.0.1]") then { stop }
if ($msg contains_i "disconnect from localhost[127.0.0.1] ehlo=1 commands=1") then { stop }
#<email-anonymizer>
#action(type="mmexternal" binary="/scripts/email-anonymizer.sh <anon-email-format>" interface.input="msg")
#</email-anonymizer>
action(type="omfile" DynaFile="devicelog" template="<log-format>" DirCreateMode="0755" FileCreateMode="0644")
}
#<email-anonymizer>
#action(type="mmexternal" binary="/scripts/email-anonymizer.sh <anon-email-format>" interface.input="msg")
#</email-anonymizer>
action(name="stdout" type="omfile" DynaFile="devicelog" template="<log-format>" DirCreateMode="0755" FileCreateMode="0644")
include(file="/etc/rsyslog.d-metrics/*.conf" mode="optional")
include(file="/etc/rsyslog.d/*.conf" mode="optional")

View file

@ -110,10 +110,10 @@ spec:
mountPath: /etc/logrotate.d/logrotate.conf
subPath: logrotate.conf
- name: metrics-config-scripts
mountPath: /etc/cron.hourly/ # Ubuntu
mountPath: /etc/cron.hourly/logrotate.sh # Ubuntu
subPath: logrotate.sh
- name: metrics-config-scripts
mountPath: /etc/periodic/hourly # Alpine
mountPath: /etc/periodic/hourly/logrotate.sh # Alpine
subPath: logrotate.sh
{{- end }}
{{- end }}
@ -142,15 +142,16 @@ spec:
name: metrics
protocol: TCP
command:
- sh
- -c
- /bin/postfix_exporter
args:
- |-
/bin/postfix_exporter
--web.listen-address {{ .Values.metrics.port }}
--web.telemetry-path {{ .Values.metrics.path | quote }}
--postfix.logfile_path {{ .Values.metrics.maillog | quote }}
--postfix.showq_path /var/spool/postfix/public/showq
- "--web.listen-address"
- {{ print "0.0.0.0:" .Values.metrics.port | quote }}
- "--web.telemetry-path"
- {{ .Values.metrics.path | quote }}
- "--postfix.logfile_path"
- {{ .Values.metrics.maillog | quote }}
- "--postfix.showq_path"
- {{ print "/var/spool/postfix/public/showq" | quote }}
volumeMounts:
- name: {{ $fullName | quote }}
mountPath: /var/spool/postfix