diff options
author | makefu <github@syntax-fehler.de> | 2017-12-30 14:08:53 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2017-12-30 14:08:53 +0100 |
commit | 57882d08962b1e5996df7ec4347ae5700c7bc650 (patch) | |
tree | c9f02fc47245a6c6f85aa0137b96d2c717d943ae /krebs/5pkgs/simple/eximlog.nix | |
parent | a6891271f1bfd3b130dedec51961288f37853420 (diff) | |
parent | c1ff2ddf713242f34a56861c34d815ae6985798b (diff) |
Merge remote-tracking branch 'lass/master' into hydra
Diffstat (limited to 'krebs/5pkgs/simple/eximlog.nix')
-rw-r--r-- | krebs/5pkgs/simple/eximlog.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/eximlog.nix b/krebs/5pkgs/simple/eximlog.nix new file mode 100644 index 000000000..2d64e13e9 --- /dev/null +++ b/krebs/5pkgs/simple/eximlog.nix @@ -0,0 +1,28 @@ +{ jq, systemd, writeDashBin }: + +let + lib = import <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)" + + ' +'' |