# Adding a global label for all metrics and logs coming from an agent policy

**URL:** <https://discuss.elastic.co/t/adding-a-global-label-for-all-metrics-and-logs-coming-from-an-agent-policy/322143>\
**Category:** Elastic Agent\
**Created:** [December 29, 2022, 10:27am UTC](https://discuss.elastic.co/t/adding-a-global-label-for-all-metrics-and-logs-coming-from-an-agent-policy/322143 "2022-12-29T10:27:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![slogger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/slogger/32/108430_2.png) [@slogger](https://discuss.elastic.co/u/slogger)\
**Post date:** [December 29, 2022, 10:27am UTC](https://discuss.elastic.co/t/adding-a-global-label-for-all-metrics-and-logs-coming-from-an-agent-policy/322143/1 "2022-12-29T10:27:27Z")

</div>

Hello

I need to have a way to filter all the logs and metrics that come from all elastic agent (and integrations) with a certain policy.  
For example all dev metrics collected by the dev agents should have a lable: env: dev.  
I have found [this](https://www.elastic.co/guide/en/beats/metricbeat/current/add-labels.html) documentation, but im not sure how it relates to the Elastic Agents.  
Our agents are managed by Fleet, and are installed into each Kubernetes cluster.  
We are collecting metrics from multiple sources and want to have this label applied to them all for filtering purposes.  
If there is a way to do this from the agent and not utilizing an ingest pipeline that would be ideal.  
I know you can add tags to agents, but from what I can see that has no use other than to filter agents in the ui.  
Thanks!

---

<div class="post-metadata">

**Author:** ![MichelLaterman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michellaterman/32/110221_2.png) [@MichelLaterman](https://discuss.elastic.co/u/MichelLaterman)\
**Post date:** [January 4, 2023, 8:13pm UTC](https://discuss.elastic.co/t/adding-a-global-label-for-all-metrics-and-logs-coming-from-an-agent-policy/322143/2 "2023-01-04T20:13:41Z")

</div>

You may be able to do this by adding processors to the integration

---

<div class="post-metadata">

**Author:** ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)\
**Post date:** [January 4, 2023, 8:46pm UTC](https://discuss.elastic.co/t/adding-a-global-label-for-all-metrics-and-logs-coming-from-an-agent-policy/322143/3 "2023-01-04T20:46:46Z")

</div>

Adding global processors to an agent policy is supposed to be in the works according to [this issue](https://github.com/elastic/elastic-agent-shipper/issues/160) in Github. However, it's currently marked `8.6-candidate`.

---

<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:** [February 1, 2023, 8:47pm UTC](https://discuss.elastic.co/t/adding-a-global-label-for-all-metrics-and-logs-coming-from-an-agent-policy/322143/4 "2023-02-01T20:47:47Z")

</div>

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