-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[receiver/awsfirehosereceiver] Fix timestamp in cwlogs #36122
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kaiyan-sheng
changed the title
[receiver/awsfirehosereceiver] Fix timestamp in cwlog
[receiver/awsfirehosereceiver] Fix timestamp in cwlogs
Oct 31, 2024
mwear
approved these changes
Nov 1, 2024
gavincabbage
approved these changes
Nov 4, 2024
Thanks for catching and fixing my mistake! Looks like the original metrics code handles this as well. |
dashpole
approved these changes
Nov 11, 2024
@Aneurysm9 would be good to get your review as the codeowner |
ChrsMark
approved these changes
Nov 15, 2024
Aneurysm9
approved these changes
Nov 20, 2024
ChrsMark
added
ready to merge
Code review completed; ready to merge by maintainers
and removed
waiting-for-code-owners
labels
Nov 20, 2024
bogdandrutu
added
the
Skip Changelog
PRs that do not require a CHANGELOG.md entry
label
Nov 20, 2024
sbylica-splunk
pushed a commit
to sbylica-splunk/opentelemetry-collector-contrib
that referenced
this pull request
Dec 17, 2024
…y#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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
ready to merge
Code review completed; ready to merge by maintainers
receiver/awsfirehose
Skip Changelog
PRs that do not require a CHANGELOG.md entry
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 from1970-01-01T00:28:49.707Z
.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.