# Understanding why only one agent policy can be assigned to an agent

**URL:** <https://discuss.elastic.co/t/understanding-why-only-one-agent-policy-can-be-assigned-to-an-agent/346828>\
**Category:** Elastic Agent\
**Created:** [November 9, 2023, 9:09pm UTC](https://discuss.elastic.co/t/understanding-why-only-one-agent-policy-can-be-assigned-to-an-agent/346828 "2023-11-09T21:09:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HHobeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hhobeck/32/121853_2.png) [@HHobeck](https://discuss.elastic.co/u/HHobeck)\
**Post date:** [November 9, 2023, 9:09pm UTC](https://discuss.elastic.co/t/understanding-why-only-one-agent-policy-can-be-assigned-to-an-agent/346828/1 "2023-11-09T21:09:11Z")

</div>

Dear community.

I'm in the situation to setup an elastic agent to retrieve logs with custom integration from a directory e.g. `d:\Logs\MyApp_Staging\*.log` on machine `A`  
and on machine `B`. So I have created an agent policy with name `myapp-staging` and assign the agent `A` and `B` to it and create a custom log integration with name `logs-myapp-staging`. Now I want to setup another application and collect the logs from `d:\Logs\AnotherApp_Testing\*.log` on machine `A`, `B` and `C`. Normally I would say to create a new agent policy with name `anotherapp-testing`, assign the agent `A`, `B` and `C` to it and create a custom log integration with name `logs-anotherapp-testing`. But this is not working because you cannot assign more than one agent policies to an agent. Installing a new agent on the same machine is also not possible.

How would you handle this scenario?

Regards

HHobeck

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [November 9, 2023, 9:22pm UTC](https://discuss.elastic.co/t/understanding-why-only-one-agent-policy-can-be-assigned-to-an-agent/346828/2 "2023-11-09T21:22:20Z")

</div>

> [@HHobeck](#):
>
> How would you handle this scenario?

If I'm not wrong you just need to add the machine C to the same policy, even if it does not have any logs for the app `myapp-staging`, it will just ignore it because the log files do not exist.

---

<div class="post-metadata">

**Author:** ![HHobeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hhobeck/32/121853_2.png) [@HHobeck](https://discuss.elastic.co/u/HHobeck)\
**Post date:** [November 10, 2023, 8:23am UTC](https://discuss.elastic.co/t/understanding-why-only-one-agent-policy-can-be-assigned-to-an-agent/346828/3 "2023-11-10T08:23:59Z")

</div>

Thank you very much for your quick reply. Do you think it is a good design? It feels like there is something missing in the way how the agents can be assigned to policies. At least it was my expectation how to do this.

Regards

HHobeck

---

<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:** [December 8, 2023, 8:24am UTC](https://discuss.elastic.co/t/understanding-why-only-one-agent-policy-can-be-assigned-to-an-agent/346828/4 "2023-12-08T08:24:03Z")

</div>

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