Document -1 as the value that disables roll_keep - #556
Conversation
The roll_keep docs said to set the value to 0 to disable log rotation retention limits, but modules/logging/filewriter.go treats a RollKeep of 0 as "not set" and falls back to the default of 10 (https://github.com/caddyserver/caddy/blob/master/modules/logging/filewriter.go#L258-L260). The value that actually disables the limit is -1, which lumberjack (the underlying rotator) treats as MaxBackups <= 0, meaning no limit. Reported in caddyserver/caddy#7863, where a maintainer confirmed this is a documentation bug and that the smallest compatible fix is documenting -1 as the disabling value, rather than changing filewriter.go's behavior. Fixes caddyserver/caddy#7863
|
Friendly ping — this is a one-line docs fix that's been open since 10 July. The Should be a quick one whenever someone has a moment. |
|
Still here a few weeks on — it's a one-liner, so happy to tweak the wording if the phrasing isn't right, just say so. |
|
Heads up for whoever gets to this: #566 opened a duplicate fix for the same issue (caddyserver/caddy#7863) on 8/15. Functionally near-identical (both correct the disable value to |
Fixes caddyserver/caddy#7863
Summary
The
roll_keepdocs say to set the value to0to disable the retention limit, but that's not what the code does:modules/logging/filewriter.gotreats aRollKeepof0as "not set" and falls back to the default of10(filewriter.go#L258-L260). The value that actually removes the limit is-1, which the underlying rotator (lumberjack) treats as "no limit" for anyMaxBackups <= 0.A maintainer confirmed this in the issue thread and noted the fix belongs here (in the docs), not in a behavior change to
caddyitself.Change
One-line correction to the
roll_keepdescription: documents-1as the disabling value and explains that0falls back to the default of10instead of disabling anything.Test plan
filewriter.go's actualRollKeep/MaxBackupshandling to confirm the new wording matches behavior.