-
Notifications
You must be signed in to change notification settings - Fork 18
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
Custom ITextFormatter BodyFormatter
for log message bodies
#134
Comments
Based on the official documentation (https://github.com/open-telemetry/opentelemetry-proto/tree/v1.1.0/examples/) we can add
|
HI! This sink only supports the |
Hello @nblumhardt I am using opentelemetry collector and I would like to be able to send logs from my services pods that are instrumented with serilog using the otlp opentelemetry sink as you saw above. I mean structuring our otlp output logs to JSON as we can with : .WriteTo.Console(formatter: new CompactJsonFormatter()) I was hoping there was an options.Encoding or something similar to send my logs in JSON. I found in this link https://github.com/open-telemetry/opentelemetry-proto/tree/v1.1.0/examples/ from otel official docs we have to pass the Content-type header to set the encoding. I can assume.WriteTo.Console(formatter: new CompactJsonFormatter()) does it under the methods but how can I do it with :
|
@nblumhardt please let me know if my details make sense for you, thank you in advance |
Hi @DevProJSSV, I think this might be something like a "body formatter" - which isn't supported right now, but might also not be needed. The body/message field from a source application is intended to be human-readable text, with all structured data included in the attributes sent along with the payload. The payload sent via the sink to the collector is fully-structured - it might be that over in the collector, you need to transform the whole thing to JSON before sending it on to its ultimate destination. What's the final destination/exporter intended for the collector's output? |
Thank you for the details @nblumhardt I am using a splunk exporter so I can send the logs to splunk platform backend. We are not doing anything on the collector side to encode the input data received at the otlp receiver. We were expecting to handle the logs format structure from the code side as we did wit the .WriteTo.Console(formatter: new CompactJsonFormatter()). But then which will be the approach I should consider for the collector configuration? Could you provide us with some references similar to my context? The only change related to the collector I could find was https://github.com/open-telemetry/opentelemetry-proto/tree/v1.1.0/examples/ which mentions we need to from the code side establish the request/response communication letting the collector know the encoding. |
I have a similar scenario. We use a custom JSON formatter that implements a company wide logging contract. We need this specific structure to be passed over to any exporters. Without this feature we can't use the sink. It looks like this would be an important upgrade. Is there any alternative? |
I'm open to the idea of specifying an Just one thing to be aware of, this would effectively put a stringified JSON object into the output location that normally contains the |
@nblumhardt correct! In the context of the "LogRecord" object, this seems like the most reasonable option. I've locally forked the project and implemented the necessary changes and it worked well from the OTEL Collector's perspective. The changes I made:
|
Thanks for digging into it @RogerVFbr! 👍 I think the property might need to be named Are you interested in sending a PR with those changes and some minimal tests? |
ITextFormatter BodyFormatter
for log message bodies
Hello is there any plan to take this option for a new release? |
Hi @DevProJSSV; it doesn't look like this will make it into 4.1.0 (just about to publish) but a minimal, tested PR should be fairly quick to get through the works if anyone watching along is able to send one. Scanning this again briefly, I think the only major implementation point not covered so far is whether |
Hello team,
I am trying to find a way to format otlp logs when using the opentelemetry sink :
I know there is a way to do it with.WriteTo.Console() bust as I am leveraging otlp communication I would like to send all structured in Json using WriteTo.OpenTelemetry().
May you recommend me any approach?. Thank you in advance @nblumhardt
The text was updated successfully, but these errors were encountered: