Skip to content

Commit

Permalink
fix: default value for logfile rotation interval (#10883)
Browse files Browse the repository at this point in the history
(cherry picked from commit fba9769)
  • Loading branch information
powersj authored and MyaLongmire committed Apr 6, 2022
1 parent b959e42 commit 6518631
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ var agentConfig = `
## The logfile will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed. Logs are rotated only when
## written to, if there is no log activity rotation may be delayed.
# logfile_rotation_interval = "0d"
# logfile_rotation_interval = "0h"
## The logfile will be rotated when it becomes larger than the specified
## size. When set to 0 no size based rotation is performed.
Expand Down
6 changes: 6 additions & 0 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func (d *Duration) UnmarshalTOML(b []byte) error {
if durStr == "" {
durStr = "0s"
}
// special case: logging interval had a default of 0d, which silently
// failed, but in order to prevent issues with default configs that had
// uncommented the option, change it from zero days to zero hours.
if durStr == "0d" {
durStr = "0h"
}

dur, err := time.ParseDuration(durStr)
if err != nil {
Expand Down

0 comments on commit 6518631

Please sign in to comment.