From 94e8d7bf849845dfd9a689cc905a8d4baf88d215 Mon Sep 17 00:00:00 2001 From: James Price Date: Tue, 16 Jun 2026 17:03:55 -0400 Subject: [PATCH] Demote Signal receipt/typing/sync spam from INFO to DEBUG signalbot logs every received envelope at INFO via `[Raw Message] {json}`. On a busy account the delivery/read receipts, typing indicators, and read-sync messages flood journald hard enough to rotate the journal down to ~1 minute, burying real traffic and making failures impossible to debug after the fact. Add a logging filter on the `signalbot` logger that suppresses content-free envelopes (anything without a `dataMessage`) at INFO, while still emitting them if the logger is explicitly set to DEBUG. Real message content stays at INFO. Co-Authored-By: Claude Opus 4.8 (1M context) --- bot.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bot.py b/bot.py index a149f39..d15945f 100644 --- a/bot.py +++ b/bot.py @@ -102,6 +102,24 @@ logging.basicConfig( ) log = logging.getLogger("signal-bot") + +class _RawReceiptNoiseFilter(logging.Filter): + """signalbot logs every received envelope at INFO via `[Raw Message] {json}`. + On a busy account that's a flood of delivery/read receipts, typing indicators, + and read-sync messages that rotates the journal down to ~1 minute and buries + real traffic. Suppress the content-free envelopes (anything without a + `dataMessage`) unless the signalbot logger is explicitly set to DEBUG — so they + stay capturable when you actually want to debug raw traffic, but don't spam INFO.""" + + def filter(self, record: logging.LogRecord) -> bool: + msg = record.getMessage() + if msg.startswith("[Raw Message] ") and '"dataMessage"' not in msg: + return logging.getLogger("signalbot").isEnabledFor(logging.DEBUG) + return True + + +logging.getLogger("signalbot").addFilter(_RawReceiptNoiseFilter()) + # (group_id, sender) -> {"b64": ..., "time": monotonic}. Keyed per sender so a # stranger's later video doesn't silently become the target of your /speed or # /rev; _get_video falls back to the group's latest video when you have none.