# Add multiple host on xpack.monitoring.elasticsearch.hosts with enviroment variable

**URL:** https://discuss.elastic.co/t/add-multiple-host-on-xpack-monitoring-elasticsearch-hosts-with-enviroment-variable/289514
**Category:** Logstash
**Tags:** elastic-stack-monitoring
**Created:** [November 18, 2021, 12:00am UTC](https://discuss.elastic.co/t/add-multiple-host-on-xpack-monitoring-elasticsearch-hosts-with-enviroment-variable/289514 "2021-11-18T00:00:48Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [November 18, 2021, 3:28pm UTC](https://discuss.elastic.co/t/add-multiple-host-on-xpack-monitoring-elasticsearch-hosts-with-enviroment-variable/289514/2 "2021-11-18T15:28:15Z")

</div>

> [@IsraelPerales](#):
>
> I try different values for the environment variable and logstash.yml but i have same error, only works with one host, if i put more than one, fails.

That is what I would expect. Related answer [here](https://discuss.elastic.co/t/filter-elements-based-on-array-constant-or-array-environment-variable/269074/2).

---

_[View the full topic](https://discuss.elastic.co/t/add-multiple-host-on-xpack-monitoring-elasticsearch-hosts-with-enviroment-variable/289514)._
