-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Otelcol-contrib attributes extract action issue #26515
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hello @sairamsadanala, to confirm my understanding, you're receiving the I think the config is essentially backwards, where your
The logic here is that we want to extract a new attribute from the value of the specified key The error message you're getting is saying that you have a matcher group in your regex, but there isn't a name specified to set what's matched. Refer to this example to see how to name the matched group. Happy to help if I missed something here or if there's any confusion. |
Hello @crobert-1, Thanks for the response. If I understand correctly is this what you are suggesting? Value of log.file.path attribute is something like /var/log/pods/_XXXX-sample-XX-default-1_d30d866a-b217-4d9a-a4c3-6dd8efb4a79a/XXX-XXX-XX-XXX/0.log. I guess the pattern that I mentioned above is invalid.
|
|
Thanks @crobert-1 I am able to extract the value and set as loki.tenant as suggested I am running into other issues now. my otelcol-contrib configuration-
it is using attributes processor and transform. Transform processor looks for log body and extractkubernetes namespace and set loki.tenant, and as you are aware attributes processor extract namespace value from log.file.path and set loki.tenant. attributes processed by Transform processor: Body: Str({"timestamp": "2023-09-08T17:59:01.965505Z", "kubernetes": {"host": "XXXXXXX", "namespace_name": "XXXX-testing"}}) Body: Str({"timestamp": "2023-09-08T18:05:01.580359Z", "kubernetes": {"host": "XXXXXXX"}}) Otelcol-contrib able to send the logs to loki when the logs are processed by Transform processor but failing ("error": "Permanent error: HTTP 401 "Unauthorized": no org id", "dropped_items": XX}. I believe it is because the tenant value is missing as show above. As per loki exporter documentation, If the loki.tenant hint attribute is present in both resource and log attributes, then the look-up for a tenant value from resource attributes takes precedence. It is working when the logs are processed by Transform but not in Attributes processor case. Am I missing anything year? |
I'm not very familiar with the loki exporter, so I'll defer to the code owners. Hopefully they can help with usage here! |
Pinging code owners for exporter/loki: @gramidt @gouthamve @jpkrohling @mar4uk. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@gramidt @gouthamve @jpkrohling @mar4uk |
/label receiver/otlphttp help-wanted -exporter/loki |
/label receiver/otlphttp help-wanted exporter/loki |
Pinging code owners for exporter/loki: @gramidt @gouthamve @jpkrohling @mar4uk. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I'm closing this in favor of #26557 |
Component(s)
processor/attributes
What happened?
Description
I am setting up otelcol-contrib hub to receive telemetry(logs) from different sources and exporting them to loki adding tenant(X-Scope-OrgID) dynamically. Otelcol-contrib hub receives log.file.path: Str(/var/log/pods/_XXXX-sample-XX-default-1_d30d866a-b217-4d9a-a4c3-6dd8efb4a79a/XXX-XXX-XX-XXX/0.log) attribute and need to extract value from log.file.path attribute and set loki.tenant attribute while exporting logs to loki endpoint.
Steps to Reproduce
Expected Result
we should see the loki.tenant
Actual Result
Collector version
0.82.0
Environment information
Environment
OS: AWS Kubernetes
OpenTelemetry Collector configuration
Log output
Additional context
No response
The text was updated successfully, but these errors were encountered: