# He given configuration is invalid. Reason: Illegal character in scheme name at index 0: \["172.23.130.220:9200","172.23.130.164:9200"\]

**URL:** https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152
**Category:** Logstash
**Created:** [February 27, 2019, 11:25am UTC](https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152 "2019-02-27T11:25:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![vaibhavjain882](https://avatars.discourse-cdn.com/v4/letter/v/ad7895/32.png) [@vaibhavjain882](https://discuss.elastic.co/u/vaibhavjain882)
#### Post date: [February 27, 2019, 11:25am UTC](https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152/1 "2019-02-27T11:25:26Z")

</div>

Hi all I am deploy logstash consumer on kubernetes with following specification:

Logstash version logstash:6.6.1  
I am picking up all the values from the environment variable, my config file looks like this:

input {  
kafka {  
type =\> nginxlogs  
bootstrap\_servers =\> ["{KAFKA\_BROKERS}"] group\_id =\> "{NGINXLOGS\_CONSUMER\_GROUP\_ID}"  
topics\_pattern =\> ["{NGINXLOGS\_KAFKA\_TOPIC\_PATTERN}"] consumer\_threads =\> "{NGINXLOGS\_CONSUMER\_THREADS}"  
metadata\_max\_age\_ms =\> "5000"  
partition\_assignment\_strategy =\> "org.apache.kafka.clients.consumer.RoundRobinAssignor"  
codec =\> "json"  
add\_field =\> {  
"broker" =\> "input\_from\_nginxlogs\_topic"  
}  
}

kafka {  
type =\> applicationlogs  
bootstrap\_servers =\> ["{KAFKA\_BROKERS}"] group\_id =\> "{APPLICATIONLOGS\_CONSUMER\_GROUP\_ID}"  
topics\_pattern =\> ["{APPLICATIONLOGS\_KAFKA\_TOPIC\_PATTERN}"] consumer\_threads =\> "{APPLICATIONLOGS\_CONSUMER\_THREADS}"  
metadata\_max\_age\_ms =\> "5000"  
partition\_assignment\_strategy =\> "org.apache.kafka.clients.consumer.RoundRobinAssignor"  
codec =\> "json"  
add\_field =\> {  
"broker" =\> "input\_from\_applicationlogs\_topic"  
}  
}

kafka {  
type =\> containerconsolelogs  
bootstrap\_servers =\> ["{KAFKA\_BROKERS}"] group\_id =\> "{CONTAINERCONSOLELOGS\_CONSUMER\_GROUP\_ID}"  
topics\_pattern =\> ["{CONTAINERCONSOLELOGS\_KAFKA\_TOPIC\_PATTERN}"] consumer\_threads =\> "{CONTAINERCONSOLELOGS\_CONSUMER\_THREADS}"  
metadata\_max\_age\_ms =\> "5000"  
partition\_assignment\_strategy =\> "org.apache.kafka.clients.consumer.RoundRobinAssignor"  
codec =\> "json"  
add\_field =\> {  
"broker" =\> "input\_from\_containerconsolelogs\_topic"  
}  
}  
}

output {  
if [type] == "nginxlogs"{  
elasticsearch {  
hosts =\> "{ELASTICSEARCH\_HOSTS}" index =\> '"{NGINXLOGS\_KAFKA\_TOPIC\_PATTERN}"-%{+YYYY.MM}'  
}  
}  
else if [type] == "applicationlogs"{  
elasticsearch {  
hosts =\> "{ELASTICSEARCH\_HOSTS}" index =\> '"{APPLICATIONLOGS\_KAFKA\_TOPIC\_PATTERN}"-%{+YYYY.MM}'  
}  
}  
else if [type] == "containerconsolelogs"{  
elasticsearch {  
hosts =\> "{ELASTICSEARCH\_HOSTS}" index =\> '"{CONTAINERCONSOLELOGS\_KAFKA\_TOPIC\_PATTERN}"-%{+YYYY.MM}'  
}  
}  
else {  
null { }  
}  
}

Issue I am facing is When I hardcode the same elasticsearch values in the file it works, but when I pass the same values in the environment variable it throughs error saying:

[2019-02-27T11:21:56,791][FATAL][logstash.runner] The given configuration is invalid. Reason: Illegal character in scheme name at index 0: ["172.23.130.220:9200","172.23.130.164:9200","172.23.130.116:9200","172.23.130.109:9200"]

I tried all possible permutation and combination didn't get anything.

Environment variables for reference:

export NGINXLOGS\_KAFKA\_TOPIC\_PATTERN="nginxlogs"  
export NGINXLOGS\_CONSUMER\_GROUP\_ID="nginxlogs"  
export NGINXLOGS\_CONSUMER\_THREADS="5"  
export APPLICATIONLOGS\_KAFKA\_TOPIC\_PATTERN="applicationlogs"  
export APPLICATIONLOGS\_CONSUMER\_GROUP\_ID="applicationlogs"  
export APPLICATIONLOGS\_CONSUMER\_THREADS="3"  
export CONTAINERCONSOLELOGS\_KAFKA\_TOPIC\_PATTERN="containerconsolelogs"  
export CONTAINERCONSOLELOGS\_CONSUMER\_GROUP\_ID="containerconsolelogs"  
export CONTAINERCONSOLELOGS\_CONSUMER\_THREADS="5"  
export BATCH\_DELAY="5"  
export BATCH\_SIZE="200"  
export KAFKA\_BROKERS=[a0a5398d9e8d-808076471.eu-west-1.elb.amazonaws.com:9092](http://a0a5398d9e8d-808076471.eu-west-1.elb.amazonaws.com:9092),  
[aed098d9e8d-808076471.eu-west-1.elb.amazonaws.com:9092](http://aed098d9e8d-808076471.eu-west-1.elb.amazonaws.com:9092)  
export ELASTICSEARCH\_HOSTS="["172.23.130.220:9200","172.23.130.164:9200","172.23.130.116:9200","172.23.130.109:9200"]"

---

<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: [February 27, 2019, 11:46am UTC](https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152/2 "2019-02-27T11:46:19Z")

</div>

The code that processes hosts expects to receive either a string containing a single host, or an array containing mulitple hosts. When you do that variable substitution it gets passed a string containing multiple hosts, and that does not work.

If you have a fixed number of hosts you can use

```
hosts => ["${ELASTICSEARCH_HOST1}", "${ELASTICSEARCH_HOST2}", "${ELASTICSEARCH_HOST3}", "${ELASTICSEARCH_HOST4}"]
```

---

<div class="post-metadata">

### Author: ![baxter19](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@baxter19](https://discuss.elastic.co/u/baxter19)
#### Post date: [March 18, 2019, 6:19pm UTC](https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152/3 "2019-03-18T18:19:12Z")

</div>

Is there any way to use an environment variable substitution with an unknown number of hosts? I've tried various ways of adding multiple host values to a single environment variable but logstash doesn't seem to like any of them.

---

<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: [March 18, 2019, 8:38pm UTC](https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152/4 "2019-03-18T20:38:14Z")

</div>

I cannot think of any way to do it.

---

<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: [April 15, 2019, 8:51pm UTC](https://discuss.elastic.co/t/he-given-configuration-is-invalid-reason-illegal-character-in-scheme-name-at-index-0-172-23-130-220-9200-172-23-130-164-9200/170152/5 "2019-04-15T20:51:34Z")

</div>

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