# Unable to use env variable with multiple hosts, for ES hosts output

**URL:** https://discuss.elastic.co/t/unable-to-use-env-variable-with-multiple-hosts-for-es-hosts-output/372982
**Category:** Logstash
**Created:** [January 9, 2025, 9:55am UTC](https://discuss.elastic.co/t/unable-to-use-env-variable-with-multiple-hosts-for-es-hosts-output/372982 "2025-01-09T09:55:32Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![aidofitz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aidofitz/32/51253_2.png) [@aidofitz](https://discuss.elastic.co/u/aidofitz)
#### Post date: [April 10, 2025, 8:47am UTC](https://discuss.elastic.co/t/unable-to-use-env-variable-with-multiple-hosts-for-es-hosts-output/372982/4 "2025-04-10T08:47:35Z")

</div>

Hi,

for info, I had the same prob and solved it with help of this post:

> [@Incorrect ELASTIC\_HOSTS variable in Logstash container](https://discuss.elastic.co/t/incorrect-elastic-hosts-variable-in-logstash-container/355599):
>
> Hi, I have a docker compose file with which I start 3 ES nodes (+ 1 for the setup), 1 Kibana, and 1 Logstash. The 4th ones works well when I deploy, but Logstash crashes. Here is the error I get from logs: [2024-03-18T11:59:04,717][ERROR][logstash.agent] Failed to execute action {:action=\>LogStash::PipelineAction::Create/pipeline\_id:main, :exception=\>"Java::JavaLang::IllegalStateException", :message=\>"Unable to configure plugins: Illegal character in scheme name at index 0: \"https:/…

in short its to do with quotes around the environment variable. In my case I was using docker compose to pass in the environment variable and it seems the initial " character was being passed right through and then being considered part of the URL. Take away the quotes around the list of servers in my docker compose file and it all works. Suspect similar behaviour happening in with other docker / k8s descriptors

---

_[View the full topic](https://discuss.elastic.co/t/unable-to-use-env-variable-with-multiple-hosts-for-es-hosts-output/372982)._
