prometheus: ignore openvpn "Connection reset, restarting" error messages

This commit is contained in:
Frédéric Péters 2021-08-03 08:04:53 +02:00
parent 3920f115c3
commit 5a091076c0
1 changed files with 7 additions and 1 deletions

View File

@ -25,6 +25,9 @@ JOURNALD_IGNORED_ERRORS = {
'dovecot.service': [
'Connection lost to LDAP server, reconnecting',
],
'': [ # match all services (useful for ovpn*)
'Connection reset, restarting [0]',
],
}
@ -101,7 +104,10 @@ def journald(ctn):
for e in j:
msg = e["MESSAGE"]
ignored_message = False
for ignored_string in JOURNALD_IGNORED_ERRORS.get(e.get('_SYSTEMD_UNIT')) or []:
ignored_strings = (
JOURNALD_IGNORED_ERRORS.get(e.get('_SYSTEMD_UNIT'), []) + JOURNALD_IGNORED_ERRORS['']
)
for ignored_string in ignored_strings:
if ignored_string in msg:
ignored_message = True
break