Setting APM for elasticsearch 7.17.4

I am trying to setup APM on elasticsearch 7.17.4 stack, i have successfully setup apm server and trying to use the Automatic setup with apm-agent-attach-cli.jar method with below flags
java -jar apm-agent-attach-cli-1.34.1.jar --include-all --include-vmarg elastic.apm.attach=true --continuous --config service_name=apm-test --config server_url=https://x.x.x.x:8200 --log-level debug --log-file /tmp/log

I see the "OK" at the end of the command execution and logs suggesting the apm is attaching to JVM however i dont see any connections. I am missing something ?

Checking if anyone has any thoughts ?

Hi @Atul_Chadha ,

What do you mean with "I don't see any connections"?

On attachment the log of the JVM you want to attach to should contain log statements from our agent. Could you please verify that this is the case?

In addition please provide the logs from the apm-agent-attach-cli execution.

@Jonas_Kunz Thank you for the response, here is what i have done so far.
Setup the APM server (Seems to be done correctly)


Downloaded the jar file and ran it using below command
java -jar apm-agent-attach-cli-1.35.0.jar --include-all --include-vmarg elastic.apm.attach=true --continuous --config service_name=apm-test --config server_url=http://XXXX:8200 --log-level trace --log-file /tmp/log

Above results in the below log

{"@timestamp":"2022-12-09T02:00:52.240Z","log.level":"DEBUG","message":"attach process started with:  user = 'root', current directory = /tmp", "ecs.version": "1.2.0","service.name":"java-attacher","event.dataset":"java-attacher.log","process.thread.name":"main","log.logger":"co.elastic.apm.attach.AgentAttacher"}
{"@timestamp":"2022-12-09T02:00:52.242Z","log.level":"DEBUG","message":"attacher arguments : Arguments{rules=DiscoveryRules{discoveryRules=[include(all), include(vmArgs(elastic.apm.attach=true))]}, config={service_name=apm-test, server_url=http://XXXX:8200}, argsProvider='null', help=false, list=false, continuous=true, logLevel=TRACE, logFile='/tmp/log', listVmArgs=false, agentJar=/tmp/elastic-apm-agent-4813494d137e1631bba301d5acab6e7b-27dac082444cc125d3c066c2b0742288.jar}", "ecs.version": "1.2.0","service.name":"java-attacher","event.dataset":"java-attacher.log","process.thread.name":"main","log.logger":"co.elastic.apm.attach.AgentAttacher"}
{"@timestamp":"2022-12-09T02:00:52.983Z","log.level":"DEBUG","message":"Looking in the following folders for hsperfdata_<user>/<pid> files: [/tmp/hsperfdata_root, /tmp/hsperfdata_spc]", "ecs.version": "1.2.0","service.name":"java-attacher","event.dataset":"java-attacher.log","process.thread.name":"main","log.logger":"co.elastic.apm.attach.JvmDiscoverer.ForHotSpotVm"}
{"@timestamp":"2022-12-09T02:00:56.975Z","log.level": "INFO","message":"Include rule include(all) matches for JVM 23153 org.elasticsearch.bootstrap.Elasticsearch", "ecs.version": "1.2.0","service.name":"java-attacher","event.dataset":"java-attacher.log","process.thread.name":"main","log.logger":"co.elastic.apm.attach.AgentAttacher"}
{"@timestamp":"2022-12-09T02:00:56.976Z","log.level": "INFO","message":"Attaching the Elastic APM agent to 23153 org.elasticsearch.bootstrap.Elasticsearch with arguments {service_name=apm-test, server_url=http://XXXX:8200}", "ecs.version": "1.2.0","service.name":"java-attacher","event.dataset":"java-attacher.log","process.thread.name":"main","log.logger":"co.elastic.apm.at

However i am not seeing any connection on the apm server when checked using netstat. I am sure the port is open, telnet works fine on port 8200.

This leads to failure of the agent check on UI

Let me know if any other info can help debug this.

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