diff --git a/openfut-blaze-host/gate-evidence.sh b/openfut-blaze-host/gate-evidence.sh index dfefe1b..85e6923 100755 --- a/openfut-blaze-host/gate-evidence.sh +++ b/openfut-blaze-host/gate-evidence.sh @@ -164,10 +164,21 @@ UTASLOG=/tmp/utas_server.log if docker exec openfut-fut-backend test -f "$UTASLOG" 2>/dev/null; then docker exec openfut-fut-backend sh -c "grep -E 'STORE:|SQUAD:|SBC:|TRADE:' $UTASLOG" \ > "$DEST/utas-actions.log" 2>/dev/null || true - packs="$(grep -c 'opened pack' "$DEST/utas-actions.log" 2>/dev/null || echo 0)" - both " pack opens recorded: $packs" - both " most recent actions:" - tail -5 "$DEST/utas-actions.log" 2>/dev/null | sed 's/^/ /' | tee -a "$DEST/summary.txt" || true + # Window to THIS gate. The UTAS log is cumulative across the whole + # deployment, so a raw count reads as if 45 packs were opened in this gate. + # The sidecar is restarted per gate, so its first log line is the window + # start. Both numbers are reported, labelled, because a bare count in a gate + # report is read as belonging to that gate. + since="$(head -1 "$LOGFILE" 2>/dev/null | sed -E 's/^\[([0-9]+)\..*/\1/')" + since_hm="$(date -d "@${since:-0}" '+%H:%M' 2>/dev/null || echo '00:00')" + all_packs="$(grep -c 'opened pack' "$DEST/utas-actions.log" 2>/dev/null || echo 0)" + gate_packs="$(awk -F'[][]' -v t="$since_hm" '$2>=t' "$DEST/utas-actions.log" 2>/dev/null \ + | grep -c 'opened pack' || echo 0)" + both " pack opens THIS GATE (since $since_hm): $gate_packs" + both " pack opens in the whole log (cumulative, all deployments): $all_packs" + both " actions this gate:" + awk -F'[][]' -v t="$since_hm" '$2>=t' "$DEST/utas-actions.log" 2>/dev/null | tail -6 \ + | sed 's/^/ /' | tee -a "$DEST/summary.txt" || true else both " utas log not readable" fi