blob: 9e5ae8d6300de0b1e8ccb7ca48b1cc98e83e63f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
{ jq, stockholm, systemd, writeDashBin }:
let
lib = stockholm.lib;
user = "exim"; # TODO make this configurable
in
# TODO execute eximlog only if journalctl doesn't fail
# bash's set -o pipefail isn't enough
writeDashBin "eximlog" ''
${systemd}/bin/journalctl \
-u ${lib.shell.escape user} \
-o short-unix \
"$@" \
|
${jq}/bin/jq -Rr '
# Only select lines that start with a timestamp
select(test("^[0-9]")) |
split(" ") |
(.[0] | tonumber) as $time |
(.[3:] | join(" ")) as $message |
"\($time | strftime("%Y-%m-%d %H:%M:%S %z")) \($message)"
'
''
|