-
Notifications
You must be signed in to change notification settings - Fork 857
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
slf4j (logback) logs not getting forwarded to open-telemetry-collector by OpenTelemetryAppender #7723
Comments
hi @ff-sdesai! can you narrow down the issue to one of these components so we can get this issue to the appropriate folks/repository?
|
Opentelemetry collector is not receiving the logs sent by the application. I confirmed this by sending logs to otel-collector using curl and it works fine. |
Firstly in https://github.com/ff-sdesai/distributed-tracing-spring/blob/main/spring-cloud-sleuth-otel-slf4j/src/main/resources/logback.xml#L13 you are using
you don't need this, you already have dependency to a newer version of
is for mdc instrumentation. If you need it then please try to align the version with the rest of the otel artifacts. You'll need to add
Finally see https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-appender-1.0/library#usage You'll have to configure the LogRecordExporter otlpGrpcLogRecordExporter =
OtlpGrpcLogRecordExporter.builder()
.setEndpoint("http://localhost:4317")
.build();
SdkLoggerProvider sdkLoggerProvider =
SdkLoggerProvider.builder()
.addLogRecordProcessor(SimpleLogRecordProcessor.create(otlpGrpcLogRecordExporter))
.build();
GlobalLoggerProvider.set(sdkLoggerProvider); to the start of the main method. There probably is a way to get |
@laurit Please ignore my previous comment (which I have deleted). I am checking if the configuration suggested by you is working for me. Will update here soon |
@laurit I did not understand the second point you said. After doing remaining changes, I am now getting following error:- |
remove |
Thanks @laurit for your help . I can see the logs in datadog now |
I have created a spring-boot micro-service with spring-cloud-sleuth. I have also configured a open-telemetry-collector to forward the logs to datadog. The otel-collector is running in a docker container along with the micro-service. I have configured io.opentelemetry.instrumentation.logback.v1_0.OpenTelemetryAppender in logback.xml file to forward the logs also to otel-collector along with traces. However, in datadog, I can only see traces and not logs. The logs printed are using the same traceId and spanId as that of trace. But due to some unknown reason, otel-collector is not exporting logs like it is exporting traces.
This issue can be reproduced using a POC with very few files and is uploaded at https://github.com/ff-sdesai/distributed-tracing-spring. The readme.md has the steps to run the application. You will need to enter a valid datadog API key in the .env (hidden) file.I will not be able to share the key since the key is specific to my organization.
Please let me know if there is something else that I should specify along with these details.
I am using docker image otel/opentelemetry-collector-contrib:0.70.0 and Ubuntu 22.04.1 LTS.
The text was updated successfully, but these errors were encountered: