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 {