Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging: Add roll_local_time Caddyfile option #4583

Merged
merged 1 commit into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions caddytest/integration/caddyfile_adapt/log_roll_days.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ log {
output file /var/log/access.log {
roll_size 1gb
roll_uncompressed
roll_local_time
roll_keep 5
roll_keep_for 90d
}
Expand All @@ -24,6 +25,7 @@ log {
"roll_gzip": false,
"roll_keep": 5,
"roll_keep_days": 90,
"roll_local_time": true,
"roll_size_mb": 954
},
"include": [
Expand Down
7 changes: 7 additions & 0 deletions modules/logging/filewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (fw FileWriter) OpenWriter() (io.WriteCloser, error) {
// roll_disabled
// roll_size <size>
// roll_uncompressed
// roll_local_time
// roll_keep <num>
// roll_keep_for <days>
// }
Expand Down Expand Up @@ -188,6 +189,12 @@ func (fw *FileWriter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
return d.ArgErr()
}

case "roll_local_time":
fw.RollLocalTime = true
if d.NextArg() {
return d.ArgErr()
}

case "roll_keep":
var keepStr string
if !d.AllArgs(&keepStr) {
Expand Down