From e1f7e0b4553a56a908b6d4b2aea2cebc8cf26248 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 17 Jul 2023 18:23:10 -0700 Subject: [PATCH] lib/logstorage: log the -retentionPeriod and -futureRetention values when the ingested log entry has timestamp outside the configured retention This should simplify debugging --- lib/logstorage/parser_test.go | 4 ++-- lib/logstorage/storage.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/logstorage/parser_test.go b/lib/logstorage/parser_test.go index 18c3f7bd60..edd7d9a043 100644 --- a/lib/logstorage/parser_test.go +++ b/lib/logstorage/parser_test.go @@ -99,8 +99,8 @@ func TestParseTimeDuration(t *testing.T) { } } f("5m", 5*time.Minute) - f("-5.5m", 5*time.Minute + 30*time.Second) - f("3d2h12m34s45ms", 3*24*time.Hour + 2*time.Hour+12*time.Minute+34*time.Second + 45*time.Millisecond) + f("-5.5m", 5*time.Minute+30*time.Second) + f("3d2h12m34s45ms", 3*24*time.Hour+2*time.Hour+12*time.Minute+34*time.Second+45*time.Millisecond) } func TestParseTimeRange(t *testing.T) { diff --git a/lib/logstorage/storage.go b/lib/logstorage/storage.go index 53a45d15ec..4a6f9c0e19 100644 --- a/lib/logstorage/storage.go +++ b/lib/logstorage/storage.go @@ -415,8 +415,8 @@ func (s *Storage) MustAddRows(lr *LogRows) { tsf := TimeFormatter(ts) minAllowedTsf := TimeFormatter(minAllowedDay * nsecPerDay) tooSmallTimestampLogger.Warnf("skipping log entry with too small timestamp=%s; it must be bigger than %s according "+ - "to the configured -retentionPeriod. See https://docs.victoriametrics.com/VictoriaLogs/#retention ; "+ - "log entry: %s", &tsf, &minAllowedTsf, &rf) + "to the configured -retentionPeriod=%dd. See https://docs.victoriametrics.com/VictoriaLogs/#retention ; "+ + "log entry: %s", &tsf, &minAllowedTsf, durationToDays(s.retention), &rf) atomic.AddUint64(&s.rowsDroppedTooSmallTimestamp, 1) continue } @@ -425,8 +425,8 @@ func (s *Storage) MustAddRows(lr *LogRows) { tsf := TimeFormatter(ts) maxAllowedTsf := TimeFormatter(maxAllowedDay * nsecPerDay) tooBigTimestampLogger.Warnf("skipping log entry with too big timestamp=%s; it must be smaller than %s according "+ - "to the configured -futureRetention; see https://docs.victoriametrics.com/VictoriaLogs/#retention ; "+ - "log entry: %s", &tsf, &maxAllowedTsf, &rf) + "to the configured -futureRetention=%dd; see https://docs.victoriametrics.com/VictoriaLogs/#retention ; "+ + "log entry: %s", &tsf, &maxAllowedTsf, durationToDays(s.futureRetention), &rf) atomic.AddUint64(&s.rowsDroppedTooBigTimestamp, 1) continue }