Skip to content
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

Is it possible to reference field from Logs Scope then transform data to Trace scope on OTEL Collector Processors #25862

Closed
wdrdres3qew5ts21 opened this issue Aug 17, 2023 · 2 comments
Labels
question Further information is requested

Comments

@wdrdres3qew5ts21
Copy link

Component(s)

No response

Describe the issue you're reporting

Hello everyone !,
Recently I had experimented with OTLP for learning I had try on using Opentelemetry auto-Instrument for tracing + logs. I would like to reference field from OTEL Logs format below as you can see in my picture field was inside "scopeLogs[1].logRecords[0].body.stringValue"

Screenshot 2023-08-17 191247

The reason I want to extract Logs field because I may have important data in that Logs Field which is printing at Standard Output but Tracing context was not had sufficient Business data.

Now I can tracing technical stuff like HTTP Method, Path, Container Name, Kubernetes detail which is quite awesome however I would like to inject my additional business context which is useful for Business Monitoring rather than IT Perspective only.

As you can see here in my Logs Output "Art Transaction=1234567890 I want reference this field from Tracing Scope"
I would like to adding Logs value of that field to my Opentelemetry Resource Field with my Customize Metadata.
So if I had very long verbose logs information I may strip message by regex and create new field at Resource Level like

  1. customLogsField derived data from some Regex pattern.
  2. artID Resource field derived data from some Regex pattern.

image

Currently I had no problem on changing/ modifying Resource Context on Tracing I can delete Resouce Field that I don't want to use on Tracing perfectly fine but I don't known How can I reference Message from Logs then set it to Tracing Context for Resource or Span context.

The end result that I just mockup should look like this one.
In picture we can using our OTEL Collector Processor to reference Logs Message then put it back to Tracing Resource Context.

image

I had try many thing follow from transformprocessor but it seem like didn't work. Most of them only work on Tracing Scope but cannot Reference Logs Message from Tracing Scop
https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor#move-field-to-attribute

image

Thank you so much for helping !

@crobert-1
Copy link
Member

Hello @wdrdres3qew5ts21, there is currently no way to do this. Each type of data has its own data pipeline, which is the essentially the scope of access in the collector. This means that a pipeline for traces won't have any knowledge of a separate pipeline for logs.

The best option for your use case would be to add the information directly to the trace itself. This would be specific to your use case, so if you'd like more information a specific configuration and use case would be very helpful.

@atoulme atoulme added question Further information is requested and removed needs triage New item requiring triage labels Sep 9, 2023
@crobert-1
Copy link
Member

I'm going to close this, but please let us know if there's anything else to do here, or if you have more questions.

@crobert-1 crobert-1 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants