feat(sudo-io): stop recording bulk data (sudoers BULK_DATA !log_output fleet-wide), drop >64 MiB streams from archives, prune existing bulk recordings

This commit is contained in:
vh
2026-10-04 22:55:49 -07:00
parent 008bd685aa
commit d9d1dd9325
6 changed files with 105 additions and 18 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ while read -r -u 3 name target; do
[[ -z ${name:-} || $name == \#* ]] && continue
if [ ${#want[@]} -gt 0 ] && [[ ! " ${want[*]} " =~ " $name " ]]; then continue; fi
r=$(ssh "${ssh_opts[@]}" "$target" "sudo -n bash -s -- pack $days" < "$hostscript" 2>&1 | grep '^RESULT' | tail -1)
read -r _ kind sha sessions files _ <<<"${r:-RESULT ERROR}"
read -r _ kind sha sessions files oversize _ <<<"${r:-RESULT ERROR}"
case "$kind" in
NOSUDOIO|NOTHING) summary+=("$name: ${kind,,}"); continue ;;
PACKED) ;;
@@ -51,9 +51,9 @@ while read -r -u 3 name target; do
summary+=("$name: archived to $f but COMMIT FAILED (${c:-no answer}); host keeps its logs"); fail=1; continue
fi
size=$(du -h "$f" | cut -f1)
summary+=("$name: $sessions sessions / $files files -> $f ($size); host ${c#RESULT COMMITTED }")
summary+=("$name: $sessions sessions / $files files (${oversize:-0} oversize streams not kept) -> $f ($size); host ${c#RESULT COMMITTED }")
[ -x "$opslog" ] && "$opslog" record --host "$name" --action archive --target sudo-io \
--detail "sudo I/O logs older than ${days}d: $sessions sessions archived to nh3-dev $f ($size, sha256 ${sha:0:12}) and cleared on the host" >/dev/null 2>&1
--detail "sudo I/O logs older than ${days}d: $sessions sessions archived to nh3-dev $f ($size, sha256 ${sha:0:12}; ${oversize:-0} oversize streams dropped) and cleared on the host" >/dev/null 2>&1
done 3< "$here/hosts"
printf '%s\n' "${summary[@]}"