Configure Elastic APM for Tomcat

2018-09-03T13:09:05.980+0530 INFO [handler] beater/handlers.go:161 Path /v1/client-side/errors added to request handler
2018-09-03T13:09:05.981+0530 INFO [handler] beater/handlers.go:161 Path /v1/rum/errors added to request handler
2018-09-03T13:09:05.981+0530 INFO [handler] beater/handlers.go:161 Path /v1/metrics added to request handler
2018-09-03T13:09:05.981+0530 INFO [handler] beater/handlers.go:161 Path /v1/rum/sourcemaps added to request handler
2018-09-03T13:09:05.981+0530 INFO [handler] beater/handlers.go:161 Path /v1/client-side/transactions added to request handler
2018-09-03T13:09:05.981+0530 INFO [handler] beater/handlers.go:161 Path /v1/rum/transactions added to request handler
2018-09-03T13:09:05.982+0530 INFO [handler] beater/handlers.go:161 Path /v1/errors added to request handler
2018-09-03T13:09:05.982+0530 INFO [handler] beater/handlers.go:161 Path /v1/client-side/sourcemaps added to request handler
2018-09-03T13:09:05.982+0530 INFO [handler] beater/handlers.go:161 Path /v1/transactions added to request handler
2018-09-03T13:09:05.982+0530 INFO [server] beater/server.go:69 Starting apm-server [59fbf0b6146ca5c50a94d1c435d0cf704e5b2a3f built 2018-08-17 22:12:40 +0000 UTC]. Hit CTRL-C to stop it.
2018-09-03T13:09:05.983+0530 INFO [server] beater/server.go:70 Listening on: 127.0.0.1:8200
2018-09-03T13:09:05.983+0530 INFO [server] beater/server.go:75 RUM endpoints disabled
2018-09-03T13:09:05.984+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "40db9bf2-4048-41db-b752-aca56b38bb19", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "Go-http-client/1.1", "response_code": 200}

2018-09-03T13:09:05.984+0530 INFO [http_client] beater/client.go:49 HTTP Server ready
2018-09-03T13:09:05.985+0530 INFO [onboarding] beater/onboarding.go:36 Publishing onboarding document
2018-09-03T13:09:06.991+0530 INFO elasticsearch/client.go:708 Connected to Elasticsearch version 6.4.0
2018-09-03T13:09:06.994+0530 INFO template/load.go:129 Template already exists and will not be overwritten.
2018-09-03T13:09:07.729+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "2cd84490-933f-4f66-a25e-b0d33a4aa45a", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "resp
onse_code": 200}
2018-09-03T13:09:17.749+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "7b227711-cefb-4927-bd6a-9f4b83b7b681", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "resp
onse_code": 200}
2018-09-03T13:09:27.750+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "042f5e73-671f-43ec-84ec-2e841a5a763b", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "resp
onse_code": 200}
2018-09-03T13:09:36.095+0530 INFO [monitoring] log/log.go:141 Non-zero metrics in the last 30s {"monitoring": {"metrics": {"apm-server":{"server":{"request":{"count":4},"response":{"count":4,"valid":{"count":4,"ok":4}}}},"beat":{"cpu":{"system":{"ticks":249,"time":{"ms":249}},"total
":{"ticks":420,"time":{"ms":420},"value":420},"user":{"ticks":171,"time":{"ms":171}}},"info":{"ephemeral_id":"13923c1a-a48e-48e2-9bd0-cfe4875db646","uptime":{"ms":30345}},"memstats":{"gc_next":4194304,"memory_alloc":2749872,"memory_total":5791224,"rss":20779008}},"libbeat":{"config":{"module":{"runn
ing":0}},"output":{"events":{"acked":1,"batches":1,"total":1},"read":{"bytes":837},"type":"elasticsearch","write":{"bytes":735}},"pipeline":{"clients":1,"events":{"active":0,"published":1,"retry":1,"total":1},"queue":{"acked":1}}},"system":{"cpu":{"cores":4}}}}}
2018-09-03T13:09:37.752+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "642dc002-e260-45d9-bba1-25556e6a1392", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "resp
onse_code": 200}

I found this in the tomcat startup log
image

How to provide the service name with JAR?

See the configuration documentation. You can, for example, add an elasticsearch.properties file in the same folder as elastic-apm-agent.jar.

The issue is resolved now I can read both .JAR and Tomcat data in kibana. Below is the snapshot from Kibana. The reason Tomcat was not reading the data was because service_name was not defined. Thus elasticapm.propertiesfile You can place aelasticapm.properties` in the same directory the agent jar resides in, is mandatory configuration.

Thanks a lot for all the discussion and direction.

2 Likes

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