lib/logstorage: log the -retentionPeriod and -futureRetention values when the ingested log entry has timestamp outside the configured retention

This should simplify debugging
This commit is contained in:
Aliaksandr Valialkin 2023-07-17 18:23:10 -07:00
parent 6751a08071
commit e1f7e0b455
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
2 changed files with 6 additions and 6 deletions

View file

@ -99,8 +99,8 @@ func TestParseTimeDuration(t *testing.T) {
} }
} }
f("5m", 5*time.Minute) f("5m", 5*time.Minute)
f("-5.5m", 5*time.Minute + 30*time.Second) 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("3d2h12m34s45ms", 3*24*time.Hour+2*time.Hour+12*time.Minute+34*time.Second+45*time.Millisecond)
} }
func TestParseTimeRange(t *testing.T) { func TestParseTimeRange(t *testing.T) {

View file

@ -415,8 +415,8 @@ func (s *Storage) MustAddRows(lr *LogRows) {
tsf := TimeFormatter(ts) tsf := TimeFormatter(ts)
minAllowedTsf := TimeFormatter(minAllowedDay * nsecPerDay) minAllowedTsf := TimeFormatter(minAllowedDay * nsecPerDay)
tooSmallTimestampLogger.Warnf("skipping log entry with too small timestamp=%s; it must be bigger than %s according "+ 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 ; "+ "to the configured -retentionPeriod=%dd. See https://docs.victoriametrics.com/VictoriaLogs/#retention ; "+
"log entry: %s", &tsf, &minAllowedTsf, &rf) "log entry: %s", &tsf, &minAllowedTsf, durationToDays(s.retention), &rf)
atomic.AddUint64(&s.rowsDroppedTooSmallTimestamp, 1) atomic.AddUint64(&s.rowsDroppedTooSmallTimestamp, 1)
continue continue
} }
@ -425,8 +425,8 @@ func (s *Storage) MustAddRows(lr *LogRows) {
tsf := TimeFormatter(ts) tsf := TimeFormatter(ts)
maxAllowedTsf := TimeFormatter(maxAllowedDay * nsecPerDay) maxAllowedTsf := TimeFormatter(maxAllowedDay * nsecPerDay)
tooBigTimestampLogger.Warnf("skipping log entry with too big timestamp=%s; it must be smaller than %s according "+ 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 ; "+ "to the configured -futureRetention=%dd; see https://docs.victoriametrics.com/VictoriaLogs/#retention ; "+
"log entry: %s", &tsf, &maxAllowedTsf, &rf) "log entry: %s", &tsf, &maxAllowedTsf, durationToDays(s.futureRetention), &rf)
atomic.AddUint64(&s.rowsDroppedTooBigTimestamp, 1) atomic.AddUint64(&s.rowsDroppedTooBigTimestamp, 1)
continue continue
} }