feat: coalesce repeated log messages to prevent log floods#29
Merged
Conversation
…n/standalone flushing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repeated per-agent SNMP anomalies and per-connection client churn could
previously drive log output without bound — a misbehaving or hostile agent
could flood the log with thousands of lines per second. This adds windowed
coalescing: the first event per key in a 10-second window logs immediately
with full detail; the rest are counted and rolled up into a single
… repeated=N interval_s=10line when the window closes.Storm cost drops to at most one detailed line plus one rollup per 10 s per
key. The UDP send-buffer overflow, previously dropped silently, now gets a
throttled notice so operators can tell sends are being lost; its statistics
counter stays exact and unconditional.
Details
allocated only for hosts that actually misbehave, so memory scales with
misbehaving hosts, not fleet size.
timer machinery.
log_debugoutput is left unthrottled (it's opt-in).Test plan
t/throttle.t(fake-clock primitive + glue), 21 assertionst/logging.textended: per-destination anomaly coalescing + client-churn coalescing subtestsmake test)scan-buildclean — No bugs found-Werrorbuild