Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[receiver/awsfirehosereceiver] Fix timestamp in cwlogs (#36122)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When testing ingesting json format logs from CloudWatch log groups using Firehose, I see the timestamp field has been populated wrong. For example the timestamp for the log message I ingested should be `2024-10-23T21:28:49.707` but I'm getting a timestamp from `1970-01-01T00:28:49.707Z`. ``` { "cloud": { "account": { "id": "123456789012" } }, "agent": { "name": "otlp", "version": "unknown" }, "@timestamp": "1970-01-01T00:28:49.707Z", "log": {}, "data_stream": { "namespace": "default", "type": "logs", "dataset": "apm.app.unknown" }, "service": { "environment": "unset", "name": "unknown", "language": { "name": "unknown" } }, "event": {}, "message": "test-1", "labels": { "aws_cloudwatch_log_stream_name": "test-log-stream", "aws_cloudwatch_log_group_name": "test-cloudwatch-logs-ks" } } } ``` This issue is caused by `pcommon.Timestamp` is a time specified as UNIX Epoch time in nanoseconds but timestamp in cloudwatch logs are in milliseconds. So converting the timestamp from milliseconds to nanoseconds is needed. #### Testing Added unit test.
- Loading branch information