#!/bin/bash # failcauses.sh SINCE_EPOCH UNTIL_EPOCH: first CRIU error line of every failed restore whose slot records were archived # (forgotten/full) in the window, counted by message (numbers masked). Root only. S=${1:?since}; U=${2:?until}; T=$(mktemp -d) for f in /var/lib/drums/forgotten/full/*.tar.zst; do ts=$(basename $f .tar.zst | sed 's/.*-//'); ts=$((ts/1000)) [ $ts -ge ${S%.*} ] && [ $ts -le ${U%.*} ] || continue mkdir -p $T/x && tar --zstd -xf $f -C $T/x 2>/dev/null for l in $(find $T/x -name 'restore-drumsd-*.log'); do grep -m1 -E "Error \(" $l | sed -E 's/^\([0-9. ]+\) *[0-9]*:? *//; s/[0-9]+/N/g' | cut -c1-110 done rm -rf $T/x done | sort | uniq -c | sort -rn rm -rf $T