Populating pipeline env variable with array of values

Hi All,

I´m trying to move from a single note cluster to the following configuration, esentially adding two ES notes for redundancy.
es1, es2, es3,
Kibana
Logstash
Multiple filebeats

I have successfully configured kibana to receive via env variable all three ES urls so it can continue working even if one ES is lost.

My issue is now with logstash, currently I have a single pipeline set up, that before now, pointed to ES like this:

hosts => [ "${ELASTICSEARCH_HOSTS}" ]

And I would later pass the value via compose or marathon using an environmental variable like:

"ELASTICSEARCH_HOSTS": "http://xxxxx.x.x:9200",

I now want to configure logstash to be able to continue pushing logs even if one ES instance is lost.

I tried everything but it wont work, if I set the pipeline directly like this:

hosts => [ "http://xxxxx.x.1:9200", "http://xxxxx.x.2:9200", "http://xxxxx.x.3:9200" ]

It works just fine, but I tried for example:

hosts => "${ELASTICSEARCH_HOSTS}"

And passing:

"ELASTICSEARCH_HOSTS": "[ "http://xxxxx.x.1:9200", "http://xxxxx.x.2:9200", "http://xxxxx.x.3:9200" ]",

Or

hosts => [ "${ELASTICSEARCH_HOSTS}" ]

And passing:

"ELASTICSEARCH_HOSTS": " "http://xxxxx.x.1:9200", "http://xxxxx.x.2:9200", "http://xxxxx.x.3:9200" ",

And I always get the same error:

"Illegal character in authority at index 7: http://xxxxx.x.1:9200", "http://xxxxx.x.2:9200", "http://xxxxx.x.3:9200"

I´ve look around on line and can´t find anything specific about being able to pass arrays in env variables, so IDK if this is possible at all.

Thanks in advance,

Regards,

That does not work.

1 Like