# Multiple service name for apm for java webapps for single tomcat server

**URL:** <https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792>\
**Category:** APM\
**Tags:** java\
**Created:** [August 18, 2021, 8:54am UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792 "2021-08-18T08:54:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryce\_Fernandes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryce_fernandes/32/71166_2.png) [@Bryce\_Fernandes](https://discuss.elastic.co/u/Bryce_Fernandes)\
**Post date:** [August 18, 2021, 8:54am UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792/1 "2021-08-18T08:54:16Z")

</div>

Hi,

I am running multiple war files in single tomcat server.  
Had a doubt if we set the following property at tomcat level how will we differentiate at application level.

set CATALINA\_OPTS=%CATALINA\_OPTS% -Delastic.apm.service\_name=my-cool-service

Regards,  
Bryce Fernandes.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [August 18, 2021, 10:22am UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792/2 "2021-08-18T10:22:22Z")

</div>

Thanks for the question.

As described in the `service_name` config [documentation](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-service-name), service names are auto-discovered by default (meaning - when the config option is not set). This should produce a service per war file.

Please make sure you use the latest version, as the former had a bug that may affect this capability.

Also notice the described caveat - the Metrics tab will not show metrics per service, instead you can view the JVM metrics under the default `tomcat-application` service.

---

<div class="post-metadata">

**Author:** ![Bryce\_Fernandes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryce_fernandes/32/71166_2.png) [@Bryce\_Fernandes](https://discuss.elastic.co/u/Bryce_Fernandes)\
**Post date:** [August 18, 2021, 10:54am UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792/3 "2021-08-18T10:54:00Z")

</div>

Hi @Eyal_Koren

Thanks for your reply. I am using elk stack and apm version 7.11.1 is it good to go?

Thanks and Regards,  
Bryce Fernandes.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [August 18, 2021, 11:32am UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792/4 "2021-08-18T11:32:46Z")

</div>

Sure thing!  
Sorry, I was referring to the Java agent version - latest is 1.25.0.

---

<div class="post-metadata">

**Author:** ![Bryce\_Fernandes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryce_fernandes/32/71166_2.png) [@Bryce\_Fernandes](https://discuss.elastic.co/u/Bryce_Fernandes)\
**Post date:** [August 18, 2021, 12:40pm UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792/5 "2021-08-18T12:40:23Z")

</div>

Thanks @Eyal_Koren

Its working fine. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 8, 2021, 8:41am UTC](https://discuss.elastic.co/t/multiple-service-name-for-apm-for-java-webapps-for-single-tomcat-server/281792/6 "2021-09-08T08:41:15Z")

</div>

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