Agent sends data to APM server but cannot see the service name in APM UI

I am trying to use APM, configured APM server and Java agent in the same machine as shown in the documentation.

apm-server.yml

apm-server:
host: "localhost:8200"
output.elasticsearch:
hosts: ["server-1:9200"]
indices:
- index: "apm-%{[beat.version]}-sourcemap"
when.contains:
processor.event: "sourcemap"
- index: "apm-%{[beat.version]}-error-%{+yyyy.MM.dd}"
when.contains:
processor.event: "error"
- index: "apm-%{[beat.version]}-transaction-%{+yyyy.MM.dd}"
when.contains:
processor.event: "transaction"
- index: "apm-%{[beat.version]}-span-%{+yyyy.MM.dd}"
when.contains:
processor.event: "span"
- index: "apm-%{[beat.version]}-metric-%{+yyyy.MM.dd}"
when.contains:
processor.event: "metric"
- index: "apm-%{[beat.version]}-onboarding-%{+yyyy.MM.dd}"
when.contains:
processor.event: "onboarding"

I have installed Java agent in the same machine and created a sample helloworld project using servlets and tomacat.

setenv.sh

export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/root/elastic-apm-agent-1.1.0.jar"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.service_name=my-service"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.application_packages=org.example"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.server_urls=http://localhost:8200"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.active=true"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.capture_body=all"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.log_level=DEBUG"

When I start the tomcat server I can see a log entry in APM server as following

2018-11-29T10:09:35.913-0500 INFO template/load.go:82 Loading template for Elasticsearch version: 6.4.1
2018-11-29T10:09:36.159-0500 INFO template/load.go:145 Elasticsearch template with name 'apm-6.5.1' loaded
2018-11-29T10:09:36.159-0500 INFO pipeline/output.go:105 Connection to backoff(elasticsearch(http://server-1:9200)) established
2018-11-29T10:18:31.520-0500 INFO [request] beater/common_handlers.go:272 handled request {"request_id": "ba321c65-9b2c-4f85-b944-45cda49de6c3", "method": "GET", "URL": "/", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "Java/1.8.0_191", "response_code": 200}
2018-11-29T10:32:57.186-0500 INFO [request] beater/common_handlers.go:272 handled request {"request_id": "6ec62ab7-5d17-40a4-ab13-ead9c6ef5300", "method": "GET", "URL": "/", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "Java/1.8.0_191", "response_code": 200}
2018-11-29T15:02:48.719-0500 INFO [request]

But why can't I see the service name in APM UI and dashboards

Hi,

Thanks for trying out Elastic APM!

That is only a log for the healthcheck and it seems like no actual data has made it to the server, that would go to the URL /v2/events.

The agent currently only supports HttpServlets, this is something to be aware of.

If you have used HttpServlets and it's still not working, please enable debug logging for the agent and upload the whole agent log here.

Cheers,
Felix

Thanks for the response. I have used HttpServlets, there was a problem with tomcat server. your information helped me to find a solution.

Thanks :slight_smile:

If you could take the time, it would be great if you could describe your solution as it might help others with similar problems :slightly_smiling_face:

yeah sure.

Tomcat server was running already and I tried to start the tomcat server again it showed me the output as

Using CATALINA_BASE: /opt/apache-tomcat-8.5.35
Using CATALINA_HOME: /opt/apache-tomcat-8.5.35
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.5.35/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/apache-tomcat-8.5.35/bin/bootstrap.jar:/opt/apache-tomcat-8.5.35/bin/tomcat-juli.jar
Tomcat started.

But, in the logs I found

Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:995)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 12 more
Caused by: java.net.BindException: Address already in use

I killed the existing process and started the tomcat server again then in the logs I can see the transactions.

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