Issue Details
Documentation about the roll_keep log rotation option at https://caddyserver.com/docs/caddyfile/directives/log#roll_keep states the following:
roll_keep is how many log files to keep before deleting the oldest ones. Triggers when a new log file is created.
To disable roll_keep, set the value to 0.
But setting the value to 0 in Caddyfile seems to have no effect and keeps a maximum of 10 log files instead. Example Caddyfile to reproduce the issue:
mywebsite:80 {
log {
output file /var/log/caddy/mywebsite.log {
roll_interval 1s
roll_keep 0
roll_keep_for 1d
}
format json
}
respond "OK"
}
# caddy --version
v2.11.4 h1:XKxkMTgNSizEvKG6QHue6cAsFOteU2qA61w2tKkCWi0=
# ls -la /var/log/caddy/ | grep log.gz | wc -l
10
This could be caused by this:
|
if fw.RollKeep == 0 { |
|
fw.RollKeep = 10 |
|
} |
Setting the value to -1 instead removes the limit.
Assistance Disclosure
AI not used
If AI was used, describe the extent to which it was used.
No response
Issue Details
Documentation about the
roll_keeplog rotation option at https://caddyserver.com/docs/caddyfile/directives/log#roll_keep states the following:But setting the value to 0 in Caddyfile seems to have no effect and keeps a maximum of 10 log files instead. Example Caddyfile to reproduce the issue:
This could be caused by this:
caddy/modules/logging/filewriter.go
Lines 258 to 260 in 4e62095
Setting the value to -1 instead removes the limit.
Assistance Disclosure
AI not used
If AI was used, describe the extent to which it was used.
No response