From 2fadf49abc5d788c492f8a7048eaacc3ff1228e7 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Mon, 13 Sep 2021 15:00:35 +0200
Subject: [PATCH] Use UTC in es-index-cleaner
Signed-off-by: Pavol Loffay
---
cmd/es-index-cleaner/main.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cmd/es-index-cleaner/main.go b/cmd/es-index-cleaner/main.go
index 3e24b14dbb4..a48ec5715e9 100644
--- a/cmd/es-index-cleaner/main.go
+++ b/cmd/es-index-cleaner/main.go
@@ -80,10 +80,10 @@ func main() {
return err
}
- year, month, day := time.Now().Date()
- tomorrowMidnight := time.Date(year, month, day, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 1)
+ year, month, day := time.Now().UTC().Date()
+ tomorrowMidnight := time.Date(year, month, day, 0, 0, 0, 0, time.UTC).AddDate(0, 0, 1)
deleteIndicesBefore := tomorrowMidnight.Add(-time.Hour * 24 * time.Duration(numOfDays))
- logger.Info("Indices before this date will be deleted", zap.Time("date", deleteIndicesBefore))
+ logger.Info("Indices before this date will be deleted", zap.String("date", deleteIndicesBefore.Format(time.RFC3339)))
filter := &app.IndexFilter{
IndexPrefix: cfg.IndexPrefix,
@@ -92,6 +92,7 @@ func main() {
Rollover: cfg.Rollover,
DeleteBeforeThisDate: deleteIndicesBefore,
}
+ logger.Info("Queried indices", zap.Any("indices", indices))
indices = filter.Filter(indices)
if len(indices) == 0 {