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

fix: default value for logfile rotation interval #10883

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
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
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