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

Hi i try monitoring logstash for detect why i have delay on the logs ingest.

But when i try put multiple hosts in the property xpack.monitoring.elasticsearch.hosts this fails .

The value is injected with the enviroment variable ELASTIC_SERVER

This is an example

xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.username: ${ELASTIC_USER}
xpack.monitoring.elasticsearch.password: ${ELASTIC_PASS}
xpack.monitoring.elasticsearch.hosts: ['${ELASTIC_SERVER}']

And the environment variable have this value

https://host1:9200,https://host2:9200

Logstash show this error:

[2021-11-17T17:32:01,398][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"URI is not valid - host is not specified"}

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.

Examples of values and logstash.yml

'https://host1:9200,https://host2:9200'
'https://host1:9200','https://host2:9200'
"https://host1:9200,https://host2:9200"
"https://host1:9200","https://host2:9200"
xpack.monitoring.elasticsearch.hosts: ['${ELASTIC_SERVER}']

xpack.monitoring.elasticsearch.hosts: [${ELASTIC_SERVER}]

xpack.monitoring.elasticsearch.hosts: ["${ELASTIC_SERVER}"]

xpack.monitoring.elasticsearch.hosts: '${ELASTIC_SERVER}'

xpack.monitoring.elasticsearch.hosts: '${ELASTIC_SERVER}'

xpack.monitoring.elasticsearch.hosts: ${ELASTIC_SERVER}

Actually my conf is:

https://host1:9200

xpack.monitoring.elasticsearch.hosts: ['${ELASTIC_SERVER}']

NOTE: Logstash 7.14.1 run as a pod inside openshift, is a custom image and for now i no have intention to add metricbeat inside to this image.

Dockerfile fragment

ADD logstash-${version}.tar.gz /opt/
ADD root /
ADD offline-plugins /opt/logstash-${version}/offline-plugins
COPY logstash.conf /opt/logstash-${version}/conf/logstash.conf
COPY run /opt/logstash-${version}/
COPY install_plugin /opt/logstash-${version}/
COPY logstash.yml /opt/logstash-${version}/config/

That is what I would expect. Related answer here.

logstash.conf works,

logstash.yml no, it's for monitoring logstash.

1 Like

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