Skip to content

Commit

Permalink
Make logs less noisy (#1000)
Browse files Browse the repository at this point in the history
### Description of change
* Move all Info logs from Olric to Debug, as they are too noisy.
* Make sampled logs appear once per 5 minutes instead of once per 5
seconds.

##### Checklist

- [x] Tested in playground or other setup
  • Loading branch information
kwapik authored Dec 5, 2022
1 parent b2cff61 commit 4c3a1ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/distcache/logwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ type OlricLogWriter struct {
func (ol *OlricLogWriter) Write(message []byte) (int, error) {
message = bytes.TrimSpace(message)
if len(message) < 2 {
ol.Logger.Info().Msg(string(message))
ol.Logger.Debug().Msg(string(message))
} else {
switch message[1] {
case 'I':
ol.Logger.Info().Msg(string(message[7:]))
ol.Logger.Debug().Msg(string(message[7:]))
case 'W':
ol.Logger.Warn().Msg(string(message[7:]))
case 'E':
ol.Logger.Error().Msg(string(message[8:]))
case 'D':
ol.Logger.Debug().Msg(string(message[8:]))
default:
ol.Logger.Info().Msg(string(message))
ol.Logger.Debug().Msg(string(message))
}
}
return len(message), nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/samplers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
func NewRatelimitingSampler() zerolog.Sampler {
return &zerolog.BurstSampler{
Burst: 1,
Period: 5 * time.Second,
Period: 5 * time.Minute,
}
}

Expand Down

0 comments on commit 4c3a1ba

Please sign in to comment.