fix: accept SAC ingest HTTP 201, 409, and legacy 202

This commit is contained in:
PTah
2026-05-28 09:13:13 +10:00
parent 31c4265716
commit 0e83d8825d
+3 -3
View File
@@ -123,7 +123,7 @@ sac_should_attempt_send() {
return 1
}
# POST готового JSON (ingest / повтор из spool). Возврат 0 при HTTP 202.
# POST готового JSON (ingest / повтор из spool). Возврат 0 при HTTP 201, 409 или 202 (legacy).
sac_post_payload() {
local payload="$1"
local event_id http_code tmp resp event_type
@@ -156,7 +156,7 @@ sac_post_payload() {
-d @"$tmp" 2>/dev/null || echo 000)"
rm -f "$tmp"
if [ "$http_code" = "202" ]; then
if [ "$http_code" = "201" ] || [ "$http_code" = "409" ] || [ "$http_code" = "202" ]; then
sac_spool_remove "$event_id" 2>/dev/null || true
sac_reset_fail_count
write_log "SAC: принято event_id=$event_id type=$event_type"
@@ -374,7 +374,7 @@ run_check_sac() {
return 1
fi
if sac_send_event "agent.test" "info" "SAC test" "ssh-monitor --check-sac"; then
printf 'SAC ingest agent.test: OK (ожидается HTTP 202)\n'
printf 'SAC ingest agent.test: OK (ожидается HTTP 201)\n'
return 0
fi
printf 'SAC ingest agent.test: FAIL\n' >&2