-
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
Adding log attributes to resource attributes #26989
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hello @sairamsadanala, have you been able to find a resolution to this issue yet? I believe from the contexts documentation in the transform processor that you should be able to use the Can you try to set the resource attribute directly from within the log context? |
Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Thanks Curtis Robert for your help.
…On Fri, Oct 6, 2023 at 2:11 PM Curtis Robert ***@***.***> wrote:
Hello @sairamsadanala <https://github.com/sairamsadanala>, have you been
able to find a resolution to this issue yet?
I believe from the contexts
<https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor#contexts>
documentation in the transform processor that you should be able to use the
logs context to insert a resource attribute directly. From the logs
context
<https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/contexts/ottllog#paths>
documentation, it looks like you should have direct resource attribute
access. This should work instead of using two steps to insert an attribute
to the log, then moving it from the log's attributes to the log's resource
attributes.
Can you try to set the resource attribute directly from within the log
context?
—
Reply to this email directly, view it on GitHub
<#26989 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKRJ4I5LAJZSMKVDOWE2YVDX6BJWXAVCNFSM6AAAAAA45KUNVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGI4TAMZYG4>
.
You are receiving this because you were mentioned.Message ID:
<open-telemetry/opentelemetry-collector-contrib/issues/26989/1751290387@
github.com>
|
It sounds like this issue is resolved. Please ping me if you're still experiencing issues |
@sairamsadanala did you end up solving this issue? if so can you share the otel config you used? |
Component(s)
processor/resource
What happened?
Description
Setting up otelcol-contrib abstraction layer to receive telemetry having multiple exporter (loki and Splunk). Otel-hub extracts Kubernetes namespace from log body using Transform processor and set loki.tenant hint so that loki exporter can send to Loki endpoint. Logs need to be routed b/w loki and Splunk based on namespace attributes. Currently i have the namespace in log attributes but Routing processor only support context(header) or resource attributes and hence trying to set resource attribute from log attribute.
Steps to Reproduce
transform:
error_mode: ignore
log_statements:
- context: log
statements:
- set(attributes["cache"], ParseJSON(body)) where IsMatch(body[""], "^\{")
- set(attributes["tenant"], attributes["cache"]["kubernetes"]["namespace_name"])
- set(attributes["loki.tenant"], "tenant")
- delete_key(attributes, "cache")
resource:
attributes:
- key: tenantname
value: tenant
action: insert
Expected Result
tenantname resource attribute should be available.
Actual Result
No resource attributes are available..
Collector version
0.82
Environment information
Environment
OS: AWS EKS
OpenTelemetry Collector configuration
Log output
Additional context
No response
The text was updated successfully, but these errors were encountered: