Scrivio Interview library
DesignAdvanced7 min read · updated 12 November 2026

One noisy dependency logs the same WARN thousands of times per minute during network blips, filling the log store and hiding other errors. Propose platform-wide protection against log floods for all services.

I would add two layers of protection: deduplication or rate limiting inside each service's logging stack (Log4j2 BurstFilter, Logback DuplicateMessageFilter or a custom turbo filter keyed on the message template) that also emits a summary of what it suppressed, and per-service, per-template rate limits in the shipper or collector as a backstop. Around that, the shared base configuration raises the level of known noisy third-party loggers, and an alert on log volume anomalies makes sure every flood is noticed and fixed at its source.

Why this question is asked

A log flood is a quiet way to lose an incident. A dependency starts warning about a network blip thousands of times a minute, the log store fills or starts throttling, ingestion falls behind, and the one ERROR line that explains the outage is buried or dropped. Interviewers ask this design question to see whether we think in layers, protecting each service and the platform, and whether we remember that suppressed information still has value. In this answer, we will see why floods happen, add protection in the service with a filter that summarises what it drops, add a second limit in the pipeline, deal with noisy third-party loggers in the shared configuration, and close with alerting so floods get fixed rather than just contained.

1Why a Log Flood Hurts More Than It Seems

Imagine a client library that logs 'Connection reset, retrying' at WARN on every failed attempt. During a 30-second network blip, 40 pods each retry hundreds of calls, and the service suddenly writes 200,000 identical lines a minute instead of 2,000 varied ones. The damage is threefold. Storage and ingest costs jump, because most log platforms charge by volume. The pipeline falls behind, so logs from every service arrive minutes late. And people searching for the real problem have to wade through a wall of identical warnings.

Notice that almost all of those lines carry the same information. The message template, the text before the arguments are filled in, is identical; only the timestamp changes. That observation is what every layer of protection below is built on.

2Layer 1: Deduplicate or Rate-Limit in the Service

The cheapest place to drop a duplicate is inside the JVM, before it is formatted and written. Logback's DuplicateMessageFilter is a turbo filter that remembers recent message templates and drops a template after it has been seen a set number of times. Log4j2's BurstFilter limits the rate of events at or below a level, letting through a burst and then a steady rate per second.

XML
<!-- Logback: drop a template after 5 repeats (cache of 200 templates) -->
<turboFilter class="ch.qos.logback.classic.turbo.DuplicateMessageFilter">
<allowedRepetitions>5</allowedRepetitions>
<cacheSize>200</cacheSize>
</turboFilter>
<!-- Log4j2: at most 50 WARN-and-below events per second, bursts up to 500 -->
<Configuration>
<BurstFilter level="WARN" rate="50" maxBurst="500"/>
</Configuration>

Both have a weakness for a platform: they drop silently. DuplicateMessageFilter also has no time window in its basic form, so a template that repeats slowly over a day is eventually suppressed too. And BurstFilter limits all events at that level together, so one noisy template can use up the budget of every other warning. That is why I would ship a small custom turbo filter in the shared logging starter: it keys on logger plus template, allows a number of events per template per minute, and counts what it drops.

3Summarising What Was Suppressed

Dropping lines without a trace is dangerous, because during an incident we need to know that something happened 4,512 times, not just that it happened. So the custom filter should emit one summary line per template per window.

Java
// Inside the shared filter: allow 20 per template per minute, then count
if (counter.incrementAndGet() > 20) { suppressed.increment(); return FilterReply.DENY; }
// Once a minute, for each template with drops:
log.warn("Suppressed {} similar messages in the last minute: logger={} template='{}'",
4512, "com.vendor.net.Client", "Connection reset, retrying {}");
// WARN Suppressed 4512 similar messages in the last minute: logger=com.vendor.net.Client template='Connection reset, retrying {}'
Step throughA flood with in-service suppression
Client libTemplate filterAppenderLog store
WARN Connection reset x 20
first 20 allowed
20 events
WARN Connection reset x 4,512
deny and count
one summary line after 1 minute
Suppressed 4512 similar messages

7 messages in order. Play them, or step through them one at a time.

The summary keeps the signal (how often, which logger, which template) and drops the noise. It is also worth exporting the suppressed count as a metric, so dashboards show the flood even though the log store does not.

4Layer 2: Limits in the Shipper or Collector

In-service protection depends on every service using the shared starter and the current version of it. Some will not: old applications, third-party products, sidecars. So the pipeline needs its own guard. Most shippers and collectors, such as Fluent Bit, Vector or the OpenTelemetry Collector, can throttle by a key. I would configure a limit per service and, where the events are structured, per logger and message template, for example 1,000 events per second per service with a higher burst. When the limit applies, the collector should add a field or emit a counter so the owning team can see that its logs were throttled.

The reason for both layers is that they protect different things. The in-service filter protects the service itself: CPU, disk and the shipper's queue on the node. The pipeline limit protects everyone else's logs in the shared store from one misbehaving source.

Step throughFlood protection layers
  1. Shared base configurationknown noisy loggers raised to ERROR or WARN
  2. In-service template filterper-template limit plus summary line and metric
  3. Node shipper or collectorper-service and per-template throttling
  4. Central log storeper-index quotas and volume anomaly alerts

4 layers, from the top down. Step through them one at a time.

5Taming Known Noisy Third-Party Loggers

Many floods come from the same handful of libraries. Once we know them, the shared base configuration can set those loggers one level higher, for example a vendor client at ERROR instead of WARN, for every service at once. That should be paired with a real fix: report the issue upstream, because a library that warns on each retry attempt rather than once per failure is a bug worth fixing, and remove the override once a fixed version is in the platform bill of materials.

6Alerting on Volume So Floods Get Fixed

Suppression contains the damage, but the flood is still a symptom. I would alert on volume anomalies: each service's events per minute compared with its usual level for that time of day, for example more than five times the normal rate for ten minutes, routed to the owning team. A weekly report of the top templates by volume across the platform helps too, because the noisiest templates are usually the cheapest to fix.

7Follow-up questions

What is the risk of suppressing messages during an incident?

We may throw away the evidence we need. If the flood is the incident, the first and last occurrences, the timing and the count are all useful, and a filter that drops silently hides all of that. That is why the filter keeps the first events of each template, emits a summary with the count, exports a metric, and never applies to ERROR events by default. During a serious incident, the on-call engineer should also be able to relax the limit for one service temporarily.

Why key the limit on the message template rather than on the final message?

Because the final message includes the arguments, so 'Connection reset, retrying host-1' and 'Connection reset, retrying host-2' look different even though they are the same problem. The template, with its placeholders, groups them. This is another reason to use parameterised logging instead of string concatenation: concatenated messages have no template, so every line looks unique.

Would sampling be better than rate limiting?

Sampling, keeping for example one in a hundred events, preserves the shape of a flood over time better than a hard limit, which keeps the first events and then nothing. For high-volume routine events, sampling is often the better choice. For warnings and errors, a limit plus a summary is easier to reason about, because the first occurrences are always kept.

8Conclusion

In this answer, we built flood protection in layers. In each service, a deduplication or rate-limiting filter keyed on the message template, such as Log4j2 BurstFilter, Logback DuplicateMessageFilter or a custom turbo filter, drops repeats and emits a summary line and a metric. In the pipeline, the shipper applies per-service and per-template limits as a backstop. The shared base configuration raises the level of known noisy libraries while the issue is reported upstream, and volume anomaly alerts make sure every flood is fixed at its source.

What to say in the interviewAbout 80 seconds aloud

Open with

I would protect the platform in two layers. Inside each service, through the shared logging starter, I would add a filter that limits repeats of the same message template.

Then, if they want more

Out of the box that could be Log4j2's BurstFilter or Logback's DuplicateMessageFilter, but both drop silently, so I would rather ship a small custom turbo filter keyed on logger plus template that allows, say, twenty events per minute and then counts the rest, and once a minute logs a summary such as suppressed 4,512 similar messages, plus a metric.

That keeps the information that a flood happened without storing every copy. As a second layer, the shipper or collector applies per-service and per-template rate limits, because not every application will use the starter, and it should mark throttled streams so owners can see it.

In the shared base configuration I would raise the level of known noisy third-party loggers and report the problem upstream so we can remove the override later. Finally, I would alert on volume anomalies per service, like five times the normal rate for ten minutes, so floods are fixed at the source instead of being hidden.

I would never suppress ERROR by default, because during an incident those lines are the evidence.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "One noisy dependency logs the same WARN thousands of times per minute during network...": https://scrivio-interview-library.netlify.app/java/java-logging/2b049f53a8/