feat(stability-v2): split backup classes, add restore-test and audit-watch timers
This commit is contained in:
Executable
+18
@@ -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
|
||||
Reference in New Issue
Block a user