Closed
Description
Description
I am experiencing an issue with the OTEL Collector configuration where the filelog receiver is unable to parse timestamps from the log files. Below are the relevant configurations and the error message encountered:
OpenTelemetry Collector configuration
receivers:
filelog:
include: [ /var/logs/*.log ]
operators:
- type: regex_parser
regex: '^(?P<timestamp>\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}:\d{3}) \[(?P<thread>[^\]]+)\] (?P<sev>[A-Z]*) (?P<msg>.*)$'
timestamp:
parse_from: attributes.timestamp
layout_typ: strptime
layout: '%Y-%m-%d-%H-%M-%S:%L'
severity:
parse_from: attributes.sev
exporters:
debug:
verbosity: detailed
service:
pipelines:
logs:
receivers: [filelog]
exporters: [debug]
Input Logs
2024-07-31-11-11-20:295 [http-nio-8300-exec-5] DEBUG com.txnws_watchlist.TxnWsWatchlist.eventing.RabbitPublisher:46 - Exit in rabbitMqEventPublisher
2024-07-31-11-11-20:295 [http-nio-8300-exec-5] DEBUG com.txnws_watchlist.TxnWsWatchlist.eventing.RabbitPublisher:46 - Exit in rabbitMqEventPublisher
2024-07-31-11-11-20:295 [http-nio-8300-exec-5] DEBUG com.txnws_watchlist.TxnWsWatchlist.eventing.RabbitPublisher:46 - Exit in rabbitMqEventPublisher
2024-07-31-11-11-20:295 [http-nio-8300-exec-5] DEBUG com.txnws_watchlist.TxnWsWatchlist.eventing.RabbitPublisher:46 - Exit in rabbitMqEventPublisher
Steps to Reproduce:
- Configure the OTEL Collector with the above configuration.
- Include log files with timestamps in the format YYYY-MM-DD-HH-MM-SS:SSS.
- Run the collector and observe the error in the logs.
Expected Result
The timestamp in the logs should be parsed correctly using the specified regex pattern and layout format.
Actual Result
2024-08-02T11:56:06.423Z error helper/transformer.go:102 Failed to process entry {"kind": "receiver", "name": "filelog","data_type": "logs", "operator_id": "regex_parser", "operator_type": "regex_parser", "error": {"description": "time parser: parsing time \"2024-07-31-11-11-20:295\" as \"2006-01-02-15-04-05::999\": cannot parse \"295\" as \"::999\""}, "action": "send"}
Collector version
v0.104.0
Environment information
OS: Amazon Linux