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