Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/1.7] fix: default json-file log size to 100MB #3681

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/logging/json_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ func (jsonLogger *JSONLogger) PreProcess(dataStore string, config *logging.Confi
l := &logrotate.Logger{
Filename: jsonFilePath,
}
//maxSize Defaults to unlimited.
var capVal int64
capVal = -1
// MaxBytes is the maximum size in bytes of the log file before it gets
// rotated. If not set, it defaults to 100 MiB.
// see: https://github.com/fahedouch/go-logrotate/blob/6a8beddaea39b2b9c77109d7fa2fe92053c063e5/logrotate.go#L500
if capacity, ok := jsonLogger.Opts[MaxSize]; ok {
var capVal int64
var err error
capVal, err = units.FromHumanSize(capacity)
if err != nil {
Expand All @@ -95,8 +96,8 @@ func (jsonLogger *JSONLogger) PreProcess(dataStore string, config *logging.Confi
if capVal <= 0 {
return fmt.Errorf("max-size must be a positive number")
}
l.MaxBytes = capVal
}
l.MaxBytes = capVal
maxFile := 1
if maxFileString, ok := jsonLogger.Opts[MaxFile]; ok {
var err error
Expand Down
Loading