Elastic, Kibana, APM version : 7.7.0
APM java agent version - 1.16.0:
Chrome latest:
Created SAAS elastic cloud acct:
**Fresh install **
**Is there anything special in your setup?**NO.
I have created a java service and also i have linked my java service to elastic APM using elastic APM agent
<dependency>
<groupId>co.elastic.apm</groupId>
<artifactId>apm-agent-attach</artifactId>
<version>1.16.0</version>
</dependency>
As described in document attached apm attached to my main method.
ElasticApmAttacher.attach();
Created elasticapm.properties file in my java service
elasticapm.properties
service_name=my-cool-service
application_packages=com.psic.ddddd
server_urls=https://dddddddddddddddddd.apm.eastus2.azure.elastic-cloud.com
secret_token=dddddd
log_level=INFO
enable_log_correlation=true
log_file=_AGENT_HOME_/logs/elastic-apm.log
log_format_file=JSON
log_format_sout=JSON
when ever i run the service i am able to get all the system and infra related logs in my APM server but my actual intention is to get the logs written in the java service using logger factory. Logger printing all the logs to my eclipse console but there is no sign of my custom created logs in APM or even the elastic-apm.log file which i have created.
JAVA SERVICE
@GetMapping("fetch")
@Produces(value = "application/json")
@ApiOperation("Get user detail ")
public FinalResponse getUserDetails(@RequestParam String agentId) {
LOGGER.info("Decrypted auth token : " + authTokendecrypted);
LOGGER.info("Incoming agentId : " + agentId);
try {
LOGGER.info("Response Success");
} catch (MyRestTemplateException execption) {
LOGGER.error(execption.getMessage());
} catch (Exception ex) {
LOGGER.error(ex.getMessage());
} finally {
LOGGER.debug("we are in finally block");
}
LOGGER.info("Get the user details information from OKTA Service End");
return finalResponse;
}
My java service will be going to write the logs using logger like
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Logger;
Unfortunately i am unable to find these logs in APM server and also the log file which i have created using apm agent log_file=AGENT_HOME/logs/elastic-apm.log.
Could some one help me to resolve the issue. Also let me know how to ship the custom created logs of my service to APM server. It would be really helpful for me to analyze and monitor all the application, system and custom created logs in APM server itself.
elastic-apm log file for reference
2020-06-06 12:45:48.701 [Attach Listener] INFO co.elastic.apm.agent.util.JmxUtils - Found JVM-specific OperatingSystemMXBean interface: com.sun.management.OperatingSystemMXBean
2020-06-06 12:45:48.763 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.16.0 as my-cool-service on Java 11.0.7 (Oracle Corporation) Windows Server 2016 10.0
2020-06-06 12:45:49.341 [elastic-apm-server-healthcheck] INFO co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: { "build_date": "2020-05-12T00:04:54Z", "build_sha": "64e91c95329991c36b16ff94fd34ea75230c06c2", "version": "7.7.0"}
2020-06-06 12:45:49.341 [elastic-apm-remote-config-poller] INFO co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Received new configuration from APM Server: {enable_log_correlation=true}
2020-06-06 12:45:50.326 [Attach Listener] INFO co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state
2020-06-06 12:45:54.249 [restartedMain] INFO co.elastic.apm.agent.servlet.ServletVersionInstrumentation - Servlet container info = Apache Tomcat/9.0.33