Document -1 as the value that disables roll_keep#556
Open
Socialpranker wants to merge 1 commit into
Open
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.