Skip to content

Commit

Permalink
Log body if timestamp is beyond TTL
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthccv committed Dec 21, 2024
1 parent 9966c2a commit 93a4d68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion exporter/clickhouselogsexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ func (e *clickhouseLogsExporter) removeOldLogs(ctx context.Context, ld plog.Logs

removeLog := func(log plog.LogRecord) bool {
t := log.Timestamp().AsTime()
return t.Unix() < acceptedDateTime.Unix()
exclude := t.Unix() < acceptedDateTime.Unix()
if exclude {
e.logger.Debug("removing log", zap.Time("timestamp", t), zap.Time("acceptedDateTime", acceptedDateTime), zap.String("body", log.Body().AsString()))
}
return exclude
}
for i := 0; i < ld.ResourceLogs().Len(); i++ {
logs := ld.ResourceLogs().At(i)
Expand Down

0 comments on commit 93a4d68

Please sign in to comment.