From c921e08296ee379da3689caa1371a3003a512648 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Sat, 19 Feb 2022 17:12:28 -0500 Subject: [PATCH] logging: Add `roll_local_time` Caddyfile option (#4583) --- caddytest/integration/caddyfile_adapt/log_roll_days.txt | 2 ++ modules/logging/filewriter.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/caddytest/integration/caddyfile_adapt/log_roll_days.txt b/caddytest/integration/caddyfile_adapt/log_roll_days.txt index 5762c92b..3ead4ac1 100644 --- a/caddytest/integration/caddyfile_adapt/log_roll_days.txt +++ b/caddytest/integration/caddyfile_adapt/log_roll_days.txt @@ -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 } @@ -24,6 +25,7 @@ log { "roll_gzip": false, "roll_keep": 5, "roll_keep_days": 90, + "roll_local_time": true, "roll_size_mb": 954 }, "include": [ diff --git a/modules/logging/filewriter.go b/modules/logging/filewriter.go index 7333fb20..c0b5715d 100644 --- a/modules/logging/filewriter.go +++ b/modules/logging/filewriter.go @@ -135,6 +135,7 @@ func (fw FileWriter) OpenWriter() (io.WriteCloser, error) { // roll_disabled // roll_size // roll_uncompressed +// roll_local_time // roll_keep // roll_keep_for // } @@ -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) {