Elastic APM property elastic.apm.enable_log_correlation does not work

Elastic Search Version: 7.3.1
APM Server Version: 7.3.1
APM Client Version: 1.9.0

I am running APM Client agent along with Spring Boot based microservices. APM Client is able to instrument and able to collect traces, metric errors.

As part of the distributed tracing, i also wanted to trace.id and transaction.id in micro service logs. Our spring boot micro services use SLF4j and Logback.

I am using the property elastic.apm.enable_log_correlation=true to enable logging.

https://www.elastic.co/guide/en/apm/agent/java/current/config-logging.html

Logback configuration as follows

{ "trace.id" : "%X{trace.id}", "transaction.id" : "%X{transaction.id}" }

But these configuration does not print any values for trace.id and transaction.id in my logs.

Is there dependency which i need to add to my spring boot project?

Hi and welcome to the forum!

We will need much more info in order to know what is not working, like- the full configuration, the agent log in debug/trace levels, what does work (eg can you get other MDC data printed to your logs) etc.

However, before all that, check out this new project which allows for automatic logging of ECS-compatible JSON that include these APM data.
We will love your feedback on it.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.