feat(stability-v2): split backup classes, add restore-test and audit-watch timers

This commit is contained in:
Prime Backup Bot
2026-03-11 20:48:29 +00:00
parent d85366027e
commit 403099cc96
8 changed files with 124 additions and 6 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
AUD=/srv/prime-core/logs/audit.jsonl
[[ -f "$AUD" ]] || exit 0
NOW=$(date +%s)
WINDOW=900
START=$((NOW-WINDOW))
COUNT=$(awk -v s="$START" 'BEGIN{c=0} {if (match($0,/"ts":([0-9]+)/,m)) if (m[1]>=s) c++} END{print c}' "$AUD")
# crude anomaly: too many commands/events in 15m
if [[ "$COUNT" -gt 300 ]]; then
source /srv/prime-core/scripts/prime-env.sh
python3 - <<'PY'
from prime_core.notify import send_telegram
send_telegram('⚠️ Prime audit anomaly: high event volume in last 15m')
PY
fi