add timestamp to mailed journal log.
Also restrict to 200 rows to prevent unreasonable large emails...
This commit is contained in:
parent
8abf7d89f6
commit
93f5a9aaad
@ -50,7 +50,11 @@ def failure(name, failures, config):
|
||||
reader.add_match(MONITOR_INVOCATION_ID=latest_inv_id)
|
||||
reader.add_disjunction()
|
||||
reader.add_match(_SYSTEMD_INVOCATION_ID=latest_inv_id)
|
||||
journal_txt = "\n".join([entry['MESSAGE'] for entry in reader])
|
||||
journal_txt = "\n".join(
|
||||
[
|
||||
f'{entry["_SOURCE_REALTIME_TIMESTAMP"]}: {entry["MESSAGE"]}'
|
||||
for entry in list(reader)[-200:]
|
||||
])
|
||||
|
||||
if nr_failures <= 1:
|
||||
subject=f"{hostname} - {name}: failure"
|
||||
|
Loading…
Reference in New Issue
Block a user