# Edit feilds.yml in apm server to get country details

**URL:** <https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705>\
**Category:** APM\
**Tags:** java\
**Created:** [April 24, 2020, 6:47pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705 "2020-04-24T18:47:57Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [April 24, 2020, 6:47pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/1 "2020-04-24T18:47:58Z")

</div>

**Kibana version** : 7.6

**Elasticsearch version** : 7.6

**APM Server version** : 7.3.2

**APM Agent language and version** : java 1.9.0

**Fresh install or upgraded from other version?** fresh install

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc. :-----No

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)** :

I am capturing country name of my application through apm labels as labels.country .  
Now I am displaying system and jvm graphs and I want to limit these graphs based on country.  
But when I put filter for labels.country the system and jvm maps disappears. So how can I map my labels.country to system or jvm properties .

I assume we have to create new fields like system.cpu.country or jvm.meory.country and map these to labels.coutry via pipeline inject right?

Or is there any other country filter already available for apm server's system and jvm properties which I can map to my labels.country

---

<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:** [April 26, 2020, 11:01am UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/2 "2020-04-26T11:01:07Z")

</div>

Hi and thanks for the question!

> [@anjana1](#):
>
> I am capturing country name of my application through apm labels as labels.country .

What is the country name of your application? Is it related to the location of the application deployment or the source of requests made to the application?  
How do you set the labels and to what context ([`global_labels`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-global-labels) or other)?

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [April 26, 2020, 5:16pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/3 "2020-04-26T17:16:15Z")

</div>

Country name is related to the location of my application request source. Labels are set through [https://www.elastic.co/guide/en/apm/get-started/current/metadata.html#labels-fields](https://www.elastic.co/guide/en/apm/get-started/current/metadata.html#labels-fields) .. setting the country name on to apm transaction label. like... span.settag("","")

---

<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:** [April 27, 2020, 4:10am UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/4 "2020-04-27T04:10:25Z")

</div>

The metrics you are referring to are OS- or JVM-level and the labels you set are on a transaction/span/error level. What is the meaning of filtering the system CPU or JVM GC-time based on a group of transactions?

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [April 27, 2020, 1:18pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/5 "2020-04-27T13:18:39Z")

</div>

So basically each APM transactions arise from say a single application residing in a host. So I want to filter the performance of the hosts based on its location.How can I achieve that

---

<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:** [April 27, 2020, 2:27pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/6 "2020-04-27T14:27:50Z")

</div>

Ahh, for that you have [`service_node_name`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-service-node-name) since 1.11.0 of the agent, just make sure you upgrade your APM server as well (it was added in 7.5). Make sure you read the documentation notes. This would give you exactly what you want - a list of nodes in the JVMs metrics tab.

Another option is using [`global_labels`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-global-labels) per service instance and use the query bar.

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [April 27, 2020, 2:55pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/7 "2020-04-27T14:55:45Z")

</div>

What if we need to group the several hosts to one specific region and provide that filter as well.? The above that you mentioned is specific to hosts right?

---

<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:** [April 27, 2020, 3:00pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/8 "2020-04-27T15:00:32Z")

</div>

`service_node_name` should be unique per JVM. That would give you the best aggregations for metrics, which contain JVM-level ones.

Still, you can use `global_labels` in any way you wish, meaning - apply a `country` label per instance, giving multiple instances the same label value where applicable.

I hope this helps.

---

<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:** [April 27, 2020, 3:01pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/9 "2020-04-27T15:01:14Z")

</div>

I think you would get the best results using both

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [April 27, 2020, 3:21pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/10 "2020-04-27T15:21:40Z")

</div>

I am sorry but is this how we set it?  
-Delastic.apm.global\_labels=[labels.country]

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [April 27, 2020, 3:52pm UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/11 "2020-04-27T15:52:32Z")

</div>

Also is global\_labels available for apm agent 1.9 and apm server 7.3.2 ?

---

<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:** [April 30, 2020, 11:42am UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/12 "2020-04-30T11:42:28Z")

</div>

Please refer to our [documentation](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-global-labels).

---

<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:** [May 21, 2020, 7:42am UTC](https://discuss.elastic.co/t/edit-feilds-yml-in-apm-server-to-get-country-details/229705/13 "2020-05-21T07:42:41Z")

</div>

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