-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
logging: Add ability to deduplicate log messages
Motivating example is to not excessively log the same http 4xx code over and over from the same ip, as this doesn't add info and bloats our log volume. This requires some abuse of logrus to work, but we do this via a formatter which can either emit the original message, or the empty string to log no message (this is harmless). Later, a seperate goroutine will emit a new log that logs the original log and how many times it occurred. We always log the first time we see a given message, then start a timer. If we see the message again at least once in that time frame, we log at the end of the time frame how many times. Note this means we can say "repeated once", which is a little confusing but preferable to displaying the original message unchanged but time delayed, which can be very misleading as there's no indication of the time delay.
- Loading branch information
Showing
1 changed file
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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