public class RateLimitFilter
extends ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent>
Filter to limit logging events to a maximum rate.
This is meant as a last resort to avoid overloading logging backends
(mainly logstash). Logging should still be tuned to avoid reaching this
limit at all. Once this filter starts dropping log events, it will not
differentiate and will silently drop all events that are over the limit.
Monitoring of this filter should be done indirectly (logging rate in the
backend).
This filter can be applied to any logback appender via the usual logback
config file.
See logback
documentation for more details on filters.
See bucket4j
for more details on the token bucket implementation backing this filter.| Constructor and Description |
|---|
RateLimitFilter() |
| Modifier and Type | Method and Description |
|---|---|
ch.qos.logback.core.spi.FilterReply |
decide(ch.qos.logback.classic.spi.ILoggingEvent event)
Deny logging if over limit, neutral otherwise.
|
void |
setBucketCapacity(int bucketCapacity) |
void |
setRefillIntervalInMillis(long refillIntervalInMillis) |
getName, isStarted, setName, start, stoppublic void setBucketCapacity(int bucketCapacity)
public void setRefillIntervalInMillis(long refillIntervalInMillis)
public ch.qos.logback.core.spi.FilterReply decide(ch.qos.logback.classic.spi.ILoggingEvent event)
decide in class ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent>Copyright © 2019. All rights reserved.