Skip to content

Commit

Permalink
fix: default json-file log size to 100MB
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Raja Yogidas <[email protected]>
  • Loading branch information
coderbirju committed Nov 13, 2024
1 parent 4a562dc commit e97bfa8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/logging/json_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,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/main/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 @@ -100,8 +101,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

0 comments on commit e97bfa8

Please sign in to comment.