i have different log appender configuration, shown below :
<appender name="JSON-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<appender name="CONSOLE-OUT-FILE" class="ch.qos.logback.core.FileAppender">
and run java agent as :
nohup java -javaagent:../elastic-apm-agent-1.35.0.jar -Delastic.apm.log_ecs_formatter_allow_list:ch.qos.logback.core.ConsoleAppender -Delastic.apm.service_name=book-service -Delastic.apm.server_urls=http://10.0.114.37:8200 -Delastic.apm.secret_token= -Delastic.apm.environment=development -Delastic.apm.application_packages=com.myapp.book -jar book-service.jar &
tail -f nohup.out
my APM agent running well including transaction, metric, Errors, except the log sender. I got message : There are no log messages to display.Try adjusting your filter.
Actually the log data is not send by the APM, but I have to configure a log sender, in this case I use filebeat
. And it works great, every transaction has log corelatively. It is possible because the APM injects trace.id
and transaction.id
, my logback.xml
config looklike this:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>../log/app.log</file>
<encoder class="co.elastic.logging.logback.EcsEncoder">
<serviceName>app-service</serviceName>
<serviceVersion>1.0</serviceVersion>
</encoder>
</appender>