From 8d3bb17853bfddfda1d92802765211d79cdc3dfc Mon Sep 17 00:00:00 2001 From: root Date: Mon, 9 Mar 2026 14:15:34 +0700 Subject: [PATCH] =?UTF-8?q?monitor:=20False-Positive-Filter=20f=C3=BCr=20H?= =?UTF-8?q?TTP-Access-Logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Artikel-Titel mit "fatal" in URLs triggerten Fehlalarme. GET/POST-Zeilen und erfolgreiche HTTP-Responses werden ignoriert. Made-with: Cursor --- homelab-ai-bot/monitor.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/homelab-ai-bot/monitor.py b/homelab-ai-bot/monitor.py index 8fd124f5..aaa2c982 100644 --- a/homelab-ai-bot/monitor.py +++ b/homelab-ai-bot/monitor.py @@ -52,11 +52,19 @@ def check_all() -> list[str]: errors = loki_client.get_errors(hours=0.5, limit=50) error_lines = [e for e in errors if "error" not in e] - panic_lines = [e for e in error_lines if - any(w in e.get("line", "").lower() for w in ["panic", "fatal", "oom", "out of memory"]) - and "query=" not in e.get("line", "") - and "caller=metrics" not in e.get("line", "") - ] + panic_lines = [] + for e in error_lines: + line = e.get("line", "") + ll = line.lower() + if not any(w in ll for w in ["panic", "fatal", "oom", "out of memory"]): + continue + if "query=" in line or "caller=metrics" in line: + continue + if "HTTP/1." in line and ('" 200 ' in line or '" 301 ' in line or '" 302 ' in line or '" 304 ' in line): + continue + if "GET /" in line or "POST /" in line or "HEAD /" in line: + continue + panic_lines.append(e) if panic_lines: hosts = set(e.get("host", "?") for e in panic_lines) hosts -= IGNORED_HOSTS