-
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
Azure Functions logs dropped due to timestamp parsing error #36650
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Triage: The issue appears to be well specified and has all necessary information. Setting to waiting on codeowners. |
The current azure event hub receiver can only parse iso8601 time string. I think it can support customized time format for more use cases as well as to address this issue. The newly added configs might be similar as below. receivers
azureeventhub:
connection: "xxxxx"
format: "azure"
# optional
time_format:
# All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time.
logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"]
metrics: [""]
traces: [""]
# optional
time_offset:
# The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0.
logs: -8
metrics: +8
traces: -8 pls let me know if any comments on this proposal. If no objections, I'd like to implement it. |
@hgaol Since Microsoft confirmed the specific time format for this issue, adding support for auto-detection of this format makes sense. However, making the timestamp formats configurable would be a more flexible and future-proof solution. This approach would allow handling any unforeseen changes in timestamp formats without needing further code modifications. |
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Support parsing more time format by configuration instead of only iso8601. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #36650 <!--Describe what testing was performed and which tests were added.--> #### Testing - Added unit test for time parsing function - Validated locally to send data with time format in the issue and received successfully <!--Describe the documentation added.--> #### Documentation Add some new configurations, including `time_format` and `time_offset`. ```yaml receivers azureeventhub: connection: "xxxxx" format: "azure" # optional time_format: # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time. logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"] metrics: [""] traces: [""] # optional time_offset: # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0. logs: -8 metrics: +8 traces: -8 ``` <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Antoine Toulme <atoulme@splunk.com>
…etry#36762) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Support parsing more time format by configuration instead of only iso8601. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#36650 <!--Describe what testing was performed and which tests were added.--> #### Testing - Added unit test for time parsing function - Validated locally to send data with time format in the issue and received successfully <!--Describe the documentation added.--> #### Documentation Add some new configurations, including `time_format` and `time_offset`. ```yaml receivers azureeventhub: connection: "xxxxx" format: "azure" # optional time_format: # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time. logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"] metrics: [""] traces: [""] # optional time_offset: # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0. logs: -8 metrics: +8 traces: -8 ``` <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Antoine Toulme <atoulme@splunk.com>
…etry#36762) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Support parsing more time format by configuration instead of only iso8601. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#36650 <!--Describe what testing was performed and which tests were added.--> #### Testing - Added unit test for time parsing function - Validated locally to send data with time format in the issue and received successfully <!--Describe the documentation added.--> #### Documentation Add some new configurations, including `time_format` and `time_offset`. ```yaml receivers azureeventhub: connection: "xxxxx" format: "azure" # optional time_format: # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time. logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"] metrics: [""] traces: [""] # optional time_offset: # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0. logs: -8 metrics: +8 traces: -8 ``` <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Antoine Toulme <atoulme@splunk.com>
…etry#36762) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Support parsing more time format by configuration instead of only iso8601. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#36650 <!--Describe what testing was performed and which tests were added.--> #### Testing - Added unit test for time parsing function - Validated locally to send data with time format in the issue and received successfully <!--Describe the documentation added.--> #### Documentation Add some new configurations, including `time_format` and `time_offset`. ```yaml receivers azureeventhub: connection: "xxxxx" format: "azure" # optional time_format: # All supported time format. Default is empty string array, which means using the current iso8601 parser. The format is based on https://pkg.go.dev/time#Layout. If no time-zone info, will use UTC time. logs: ["01/02/2006 15:04:05","2006-01-02 15:04:05","2006-01-02T15:04:05Z07:00"] metrics: [""] traces: [""] # optional time_offset: # The offset hours to parsed time. Mainly for cases when there's no time-zone info in time string. default is 0. logs: -8 metrics: +8 traces: -8 ``` <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Antoine Toulme <atoulme@splunk.com>
Component(s)
pkg/translator/azure, pkg/translator/azurelogs
What happened?
Description
For Azure Functions, all logs are being dropped by the OpenTelemetry collector due to a timestamp parsing error. The issue is that the timestamp format used in the logs (11/20/2024 13:57:18) is not being correctly parsed by the OpenTelemetry collector. The collector expects an ISO8601 or RFC3339 format for timestamps, which leads to the logs being dropped.
Checking in Azure documentation, we cannot find a definitive answer regarding the proper format for timestamps in Azure logs:
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/resource-logs-schema#top-level-common-schema
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log-schema#schema-from-storage-account-and-event-hubs
https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/functionapplogs
However, Microsoft support has confirmed the timestamp format logged by Azure Functions varies depending on the App Service Plan being used:
See Azure/azure-functions-host#7864. No ETA has been provided for Functions Runtime v5 which would supposedly fix the issue.
A similar issue has been previously reported in:
#31244
#27589
Steps to Reproduce
Expected Result
Logs from Azure Functions should be processed without errors, regardless of the timestamp format used.
Actual Result
An error is generated when processing logs with a timestamp in US format, leading to logs being dropped.
Collector version
0.114.0
Environment information
OS: "Ubuntu 20.04"
OpenTelemetry Collector configuration
Log output
Additional context
Sample events retrieved directly from Azure Event Hub:
The text was updated successfully, but these errors were encountered: