# How does apm-server set service.name?

**URL:** <https://discuss.elastic.co/t/how-does-apm-server-set-service-name/296556>\
**Category:** APM\
**Tags:** server\
**Created:** [February 8, 2022, 7:51am UTC](https://discuss.elastic.co/t/how-does-apm-server-set-service-name/296556 "2022-02-08T07:51:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [February 8, 2022, 7:51am UTC](https://discuss.elastic.co/t/how-does-apm-server-set-service-name/296556/1 "2022-02-08T07:51:33Z")

</div>

I have deployed apm-server on multiple public cloud kubernetes clusters, but when they send health metrics to elasticsearch, the service.name is all called apm-server , is there any way to distinguish it? I checked the apm-server documentation and found no instructions on how to set the service.name, only a "name" can be used, but in fact it only generates a Beat name, and does not change the service.name.

> {"log.level":"info","@timestamp":"2022-02-08T07:37:25.618Z","log.logger":"publisher","log.origin":{"file.name":"pipeline/module.go","file.line":113},"message":"Beat name: lonsid-aks","service.name":"apm-server","ecs.version":"1.6.0"}

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [February 11, 2022, 2:08am UTC](https://discuss.elastic.co/t/how-does-apm-server-set-service-name/296556/2 "2022-02-11T02:08:54Z")

</div>

How are you sending the logs to Elasticsearch? Are you using Filebeat? If so, can you use one of its [processors](https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html) to enrich the logs, e.g. by adding the host name?

[`service.name`](https://www.elastic.co/guide/en/ecs/current/ecs-service.html#field-service-name) is meant to be the same for all nodes of a service, so it is expected that it's always just "apm-server". In theory we could set [`service.node.name`](https://www.elastic.co/guide/en/ecs/current/ecs-service.html#field-service-node-name) in the logs, but you would need to configure this manually. There's currently no way to do this in apm-server.yml, so you would need to add it through Filebeat or similar.

---

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [February 11, 2022, 5:52am UTC](https://discuss.elastic.co/t/how-does-apm-server-set-service-name/296556/3 "2022-02-11T05:52:38Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e9191802d635b21cc1e669a529dfdefeca7c0aa2.png)  
Thank you for your reply, I noticed after posting that "Stack Monitoring" shows the beat name, so the problem is solved.  
I will refer to your suggestion to enrich the log meta collected by filebeat

---

<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:** [March 4, 2022, 1:53am UTC](https://discuss.elastic.co/t/how-does-apm-server-set-service-name/296556/4 "2022-03-04T01:53:38Z")

</div>

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