diff --git a/config/config.go b/config/config.go index 97772a6ca..b17bbad29 100644 --- a/config/config.go +++ b/config/config.go @@ -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. diff --git a/config/types.go b/config/types.go index 5e67896ff..227b1e18d 100644 --- a/config/types.go +++ b/config/types.go @@ -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 {