Merge remote-tracking branch 'cd/master'
This commit is contained in:
commit
37d53d7b25
7
Makefile
7
Makefile
@ -130,7 +130,12 @@ $(error bad method: $(method))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
test: ssh ?= ssh
|
test: ssh ?= ssh
|
||||||
|
ifeq ($(target_user)@$(target_host),$(LOGNAME)@$(HOSTNAME))
|
||||||
|
test: wrapper = exec
|
||||||
|
else
|
||||||
|
test: wrapper = $(ssh) $(target_user)@$(target_host) -p $(target_port)
|
||||||
|
endif
|
||||||
test: populate
|
test: populate
|
||||||
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
|
$(wrapper) \
|
||||||
$(command) --show-trace -I $(target_path) \
|
$(command) --show-trace -I $(target_path) \
|
||||||
-A config.system.build.toplevel $(target_path)/stockholm
|
-A config.system.build.toplevel $(target_path)/stockholm
|
||||||
|
@ -14,23 +14,27 @@ let
|
|||||||
"5" = 255; # notice
|
"5" = 255; # notice
|
||||||
"6" = 250; # info
|
"6" = 250; # info
|
||||||
"7" = 139; # debug
|
"7" = 139; # debug
|
||||||
|
"-" = 005; # undefined priority
|
||||||
};
|
};
|
||||||
|
default-urgent = pkgs.writeJSON "logf.default-urgent.json" [
|
||||||
|
];
|
||||||
in
|
in
|
||||||
|
|
||||||
pkgs.writeDashBin "logf" ''
|
pkgs.writeDashBin "logf" ''
|
||||||
export LOGF_HOST_COLORS LOGF_PRIO_COLORS
|
export LOGF_HOST_COLORS LOGF_PRIO_COLORS LOGF_URGENT
|
||||||
LOGF_HOST_COLORS=$(cat "''${LOGF_HOST_COLORS-${default-host-colors}}")
|
LOGF_HOST_COLORS=$(cat "''${LOGF_HOST_COLORS-${default-host-colors}}")
|
||||||
LOGF_PRIO_COLORS=$(cat "''${LOGF_PRIO_COLORS-${default-prio-colors}}")
|
LOGF_PRIO_COLORS=$(cat "''${LOGF_PRIO_COLORS-${default-prio-colors}}")
|
||||||
|
LOGF_URGENT=$(cat "''${LOGF_URGENT-${default-urgent}}")
|
||||||
printf '%s\0' "$@" \
|
printf '%s\0' "$@" \
|
||||||
| ${pkgs.findutils}/bin/xargs -0 -P 0 -n 1 ${pkgs.writeDash "logf-remote" ''
|
| ${pkgs.findutils}/bin/xargs -0 -P 0 -n 1 ${pkgs.writeDash "logf-remote" ''
|
||||||
target=$1 \
|
target=$1
|
||||||
target_host=$(echo "$1" | sed 's/^.*@//;s/\..*//') \
|
target_host=$(echo "$1" | sed 's/^.*@//;s/\..*//')
|
||||||
exec 3>&1;
|
exec 3>&1
|
||||||
2>&1 1>&3 ssh "$target" -T \
|
2>&1 1>&3 ssh "$target" -T \
|
||||||
-o PreferredAuthentications=publickey \
|
-o PreferredAuthentications=publickey \
|
||||||
-o StrictHostKeyChecking=yes \
|
-o StrictHostKeyChecking=yes \
|
||||||
exec journalctl -af -n 0 -o json \
|
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",
|
PRIORITY: "4",
|
||||||
MESSAGE: .,
|
MESSAGE: .,
|
||||||
@ -40,9 +44,11 @@ pkgs.writeDashBin "logf" ''
|
|||||||
sleep 10m
|
sleep 10m
|
||||||
exec "$0" "$@"
|
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_HOST_COLORS | fromjson) as $host_colors |
|
||||||
(env.LOGF_PRIO_COLORS | fromjson) as $prio_colors |
|
(env.LOGF_PRIO_COLORS | fromjson) as $prio_colors |
|
||||||
|
(env.LOGF_URGENT | fromjson | map("(\(.))") | join("|"))
|
||||||
|
as $urgent_regex |
|
||||||
|
|
||||||
def when(c; f): if c then f else . end;
|
def when(c; f): if c then f else . end;
|
||||||
|
|
||||||
@ -88,10 +94,14 @@ pkgs.writeDashBin "logf" ''
|
|||||||
as $prio_c |
|
as $prio_c |
|
||||||
.MESSAGE
|
.MESSAGE
|
||||||
| sub("\r$"; "")
|
| sub("\r$"; "")
|
||||||
| agsub("\\btv@nomic\\b"; "\(.)\u0007" | col(fg(219); $prio_c))
|
| agsub($urgent_regex; "\(.)\u0007" | col(fg(219); $prio_c))
|
||||||
#| agsub("Start queue"; "\(.)\u0007" | col(fg(42); $prio_c))
|
|
||||||
| col($prio_c);
|
| col($prio_c);
|
||||||
|
|
||||||
|
try fromjson catch {
|
||||||
|
_SOURCE_REALTIME_TIMESTAMP: now | tostring | sub("[.]"; ""),
|
||||||
|
SYSLOG_IDENTIFIER: "logf/journalctl",
|
||||||
|
MESSAGE: .,
|
||||||
|
} |
|
||||||
|
|
||||||
[ p_time
|
[ p_time
|
||||||
, p_host
|
, p_host
|
||||||
|
@ -190,4 +190,7 @@ pkgs.writeBashBin "q" ''
|
|||||||
(${q-thermal_zone}) &
|
(${q-thermal_zone}) &
|
||||||
wait
|
wait
|
||||||
${q-todo}
|
${q-todo}
|
||||||
|
if [ "$PWD" != "$HOME" ]; then
|
||||||
|
(HOME=$PWD; ${q-todo})
|
||||||
|
fi
|
||||||
''
|
''
|
||||||
|
Loading…
Reference in New Issue
Block a user