Pull request: querylog: fix rotation

Updates #3781.

Squashed commit of the following:

commit 43e76450b02f7ec54a1b23e5bb037685c2b89bbf
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 29 13:29:34 2021 +0300

    querylog: imp err handling, names

commit b53cfb9c29473e5e0753169e019be5b73d42361c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 29 13:17:00 2021 +0300

    querylog: fix rotation
This commit is contained in:
Ainar Garipov
2021-10-29 13:43:08 +03:00
parent 1e52b309aa
commit 1e72960140
2 changed files with 39 additions and 24 deletions

View File

@@ -46,11 +46,11 @@ type Config struct {
// old log file will be renamed, NOT deleted, so the actual log
// retention time is twice the interval. The value must be one of:
//
// 6 * time.Hour
// 24 * time.Hour
// 7 * 24 * time.Hour
// 30 * 24 * time.Hour
// 90 * 24 * time.Hour
// 6 * time.Hour
// 1 * timeutil.Day
// 7 * timeutil.Day
// 30 * timeutil.Day
// 90 * timeutil.Day
//
RotationIvl time.Duration
@@ -123,7 +123,7 @@ func newQueryLog(conf Config) (l *queryLog) {
if !checkInterval(conf.RotationIvl) {
log.Info(
"querylog: warning: unsupported rotation interval %d, setting to 1 day",
"querylog: warning: unsupported rotation interval %s, setting to 1 day",
conf.RotationIvl,
)
l.conf.RotationIvl = timeutil.Day