Skip to content

Commit

Permalink
logging: Add roll_local_time Caddyfile option (#4583)
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie committed Feb 19, 2022
1 parent ddbb234 commit c921e08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit c921e08

Please sign in to comment.