Skip to content

Commit a670871

Browse files
committed
relay: drop legacy POST / path — fluentd /ingest is the sole input
Now that the Cribl modsec route is gone (deleted in the Cribl runtime; not in fleet because Cribl Free's config lives in its own PVC), the legacy / path on the relay was only catching stragglers from the destination's PQ replay. Drop them. Result: only fluentd-direct events flow through. Content-Length matches actual bytes (cl=17737 actual=17737), regex extraction sees full untruncated log lines, and AM gets PostableAlerts with host/rule_id/method/uri all populated.
1 parent 998b9ee commit a670871

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

monitoring-cribl-am-relay/relay.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,26 @@ data:
154154
if isinstance(parsed, dict):
155155
parsed = [parsed]
156156
157+
# /ingest is the only supported path. Legacy Cribl webhook
158+
# (POST /) is dropped because Cribl 4.17.1 truncates events
159+
# and we get back garbage host=? alerts — the fluentd direct
160+
# path supersedes it.
161+
if self.path != "/ingest":
162+
self.send_response(204); self.end_headers(); return
163+
157164
alerts = []
158165
for ev in parsed:
159166
if not isinstance(ev, dict):
160167
continue
161-
162-
if self.path == "/ingest":
163-
line = ev.get("log") or ev.get("message") or ev.get("_raw") or ""
164-
line = line if isinstance(line, str) else str(line)
165-
fields = extract_modsec_fields(line)
166-
if not fields:
167-
continue
168-
ip = fields.get("client_ip", "")
169-
if not TRUSTED_IP_RE.match(ip):
170-
continue # untrusted source — bot scan, drop
171-
alerts.append(build_modsec_alert(fields))
172-
elif ev.get("signal") == "modsec_block":
173-
alerts.append(enrich_modsec_signal(ev))
174-
elif "labels" in ev and isinstance(ev.get("labels"), dict):
175-
alerts.append(ev)
176-
else:
177-
print(f" skip unrecognized payload: {str(ev)[:120]!r}", flush=True)
168+
line = ev.get("log") or ev.get("message") or ev.get("_raw") or ""
169+
line = line if isinstance(line, str) else str(line)
170+
fields = extract_modsec_fields(line)
171+
if not fields:
172+
continue
173+
ip = fields.get("client_ip", "")
174+
if not TRUSTED_IP_RE.match(ip):
175+
continue # untrusted source — bot scan, drop
176+
alerts.append(build_modsec_alert(fields))
178177
179178
if not alerts:
180179
self.send_response(204); self.end_headers(); return

0 commit comments

Comments
 (0)