Dear Maintainer,
Logcheck filters always operate on one single line, yet multi-line logs are
possible (at least with systemd-journal, not sure about syslog). This breaks
logchecks filtering and the corresponding e-mail reports will contain partial
logs.
As an example, opendmarc creates log entries like these:
spf=pass (google.com: domain of 3cgimarqkaacnvvnslhsly0z-uvylws5nvvnsl.jvt@alerts.bounces.google.com designates 209.85.220.69 as permitted sender) smt>
dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com;
dara=pass header.i=@gmail.com"
---
One solution is to write separate filters for all of these lines but that's
not always a good idea.
I would propose the following solution:
This problem could be rectified by a different kind processing of the
journalctl output. The following will replace all newlines in a log by a
space but otherwise produce the same output format as a normal call to
journalctl. (admittedly it's a quick hack, maybe could use some more
refinement...)
journalctl -o json | jq -r '
def ts:
(.__REALTIME_TIMESTAMP | tonumber / 1000000 | strftime("%b %d %H:%M:%S"));
"\(ts) \(._HOSTNAME // "-") \(.SYSLOG_IDENTIFIER // "unknown")[\(._PID // "-")]: \((.MESSAGE // "") | gsub("\n"; " "))"
This will add a dependency to jq. It will also definitely processing time,
but should be negligible.
Best regards,
Klaus