@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.