Skip to content

Commit

Permalink
Fix: Fix syslog logging to stdout + fix starting of exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed Oct 27, 2023
1 parent 5a09ee5 commit bcf7dcb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
25 changes: 20 additions & 5 deletions configs/rsyslog.conf
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")

Expand Down
21 changes: 11 additions & 10 deletions helm/mail/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bcf7dcb

Please sign in to comment.