diff options
author | tv <tv@krebsco.de> | 2016-08-04 20:37:53 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-08-04 20:37:53 +0200 |
commit | a264c571f3b3bc096df11f84f8fd8c48ff591923 (patch) | |
tree | 65ec345058f8e0b97e37ab3b19dfa50749d7a257 | |
parent | 1bc62944e3e8eac639e2373c868a56c36bb67fb7 (diff) |
logf: survive non-JSON input
-rw-r--r-- | krebs/5pkgs/logf/default.nix | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/krebs/5pkgs/logf/default.nix b/krebs/5pkgs/logf/default.nix index d73a1817a..b575c1879 100644 --- a/krebs/5pkgs/logf/default.nix +++ b/krebs/5pkgs/logf/default.nix @@ -31,7 +31,7 @@ pkgs.writeDashBin "logf" '' -o PreferredAuthentications=publickey \ -o StrictHostKeyChecking=yes \ exec journalctl -af -n 0 -o json \ - | stdbuf -oL jq -Rf ${pkgs.writeJq "logf-remote-error.jq" '' + | stdbuf -oL jq -Rcf ${pkgs.writeJq "logf-remote-error.jq" '' { PRIORITY: "4", MESSAGE: ., @@ -41,7 +41,7 @@ pkgs.writeDashBin "logf" '' sleep 10m exec "$0" "$@" ''} \ - | ${pkgs.jq}/bin/jq -rf ${pkgs.writeJq "logf-filter.jq" '' + | ${pkgs.jq}/bin/jq -Rrf ${pkgs.writeJq "logf-filter.jq" '' (env.LOGF_HOST_COLORS | fromjson) as $host_colors | (env.LOGF_PRIO_COLORS | fromjson) as $prio_colors | @@ -93,6 +93,11 @@ pkgs.writeDashBin "logf" '' #| agsub("Start queue"; "\(.)\u0007" | col(fg(42); $prio_c)) | col($prio_c); + try fromjson catch { + _SOURCE_REALTIME_TIMESTAMP: now | tostring | sub("[.]"; ""), + SYSLOG_IDENTIFIER: "logf/journalctl", + MESSAGE: ., + } | [ p_time , p_host |