fix: default value for logfile rotation interval (#10883)
This commit is contained in:
parent
b9151ff560
commit
fba9769720
|
|
@ -404,7 +404,7 @@ var agentConfig = `
|
||||||
## The logfile will be rotated after the time interval specified. When set
|
## 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
|
## 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.
|
## 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
|
## The logfile will be rotated when it becomes larger than the specified
|
||||||
## size. When set to 0 no size based rotation is performed.
|
## size. When set to 0 no size based rotation is performed.
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,12 @@ func (d *Duration) UnmarshalTOML(b []byte) error {
|
||||||
if durStr == "" {
|
if durStr == "" {
|
||||||
durStr = "0s"
|
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)
|
dur, err := time.ParseDuration(durStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue