summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/logf/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-08-04 20:37:53 +0200
committertv <tv@krebsco.de>2016-08-04 20:37:53 +0200
commita264c571f3b3bc096df11f84f8fd8c48ff591923 (patch)
tree65ec345058f8e0b97e37ab3b19dfa50749d7a257 /krebs/5pkgs/logf/default.nix
parent1bc62944e3e8eac639e2373c868a56c36bb67fb7 (diff)
logf: survive non-JSON input
Diffstat (limited to 'krebs/5pkgs/logf/default.nix')
-rw-r--r--krebs/5pkgs/logf/default.nix9
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