Description
Component(s)
receiver/filelog
What happened?
Description
Application is writing to uncompressed logfile, with log rotation configured so that when the log file is rotated it's also compressed. The OTel Collector logfile receiver is configured for both the uncompressed log file path and for the compressed "archive" log file paths.
Updates to the live log are processed correctly. However when a "live" log file reaches the size limit and is rotated and compressed, the new compressed logfile is detected as a completely new logfile, so all its contents are re-read and parsed again, resulting in lots of duplication.
Might be an issue with fingerprinting - if the rotated/compressed log file's fingerprint differs from the fingerprint of the original uncompressed file if the fingerprinting is done on the raw bytes of the compressed file, not on its uncompressed contents.
Steps to Reproduce
Set up application and configure log rotation with compression. Set up collector with filelog receiver for both the uncompressed and the rotated-compressed files. Wait for log rotation - observe that the entire rotated/compressed log file is re-read.
Expected Result
Only the last few lines are read from the rotated/compressed log file (whatever wasn't caught just before the rotation)
Actual Result
The entire rotated/compressed log file is re-read.
Collector version
v0.127.0
Environment information
Environment
OS: RHEL9.5
OpenTelemetry Collector configuration
receivers:
filelog/uncompressed:
include: [ logs/*.log ]
filelog/compressed:
include: [ logs/*.log.gz ]
compression: gzip
exporters:
debug:
verbosity: basic
service:
pipelines:
logs:
receivers: [ filelog/uncompressed, filelog/compressed ]
processors: [ ]
exporters: [ debug ]
Log output
2025-06-06T14:19:56.429Z info Logs {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
2025-06-06T14:19:57.355Z info fileconsumer/file.go:267 Started watching file {"resource": {}, "otelcol.component.id": "filelog/uncompressed", "otelcol.component.kind": "receiver", "otelcol.signal": "logs", "component": "fileconsumer", "path": "logs/test.log"}
2025-06-06T14:19:57.430Z info Logs {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
2025-06-06T14:19:59.429Z info Logs {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
2025-06-06T14:20:00.223Z info fileconsumer/file.go:267 Started watching file {"resource": {}, "otelcol.component.id": "filelog/compressed", "otelcol.component.kind": "receiver", "otelcol.signal": "logs", "component": "fileconsumer", "path": "logs/test-2025-06-06.0.log.gz"}
2025-06-06T14:20:00.429Z info Logs {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
2025-06-06T14:20:00.568Z info Logs {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 27}
Additional context
No response