ENvironmental variable hostname in logstash.yml and pipelines.yml or logstash.conf

I have pipeline id in pipelines.yml=> pipe-common

I want to give id as pipe-common_

So the hostname should be dynamic from the environmentla variables of OS level.

I can use ${hostname} variable in shell script. same way, can I use hostname variable in logstash.yml or pipelines.yml or logstash.conf?
I want to make the configurations so that on any host i can use same dynamic config files and no need to change everytime.
Anybody has the sampel code for that?

@sunilmchaudhari

See https://www.elastic.co/guide/en/logstash/current/environment-variables.html

You need to put the ENV variable in /etc/default/logstash on the Logstash node after which you can use the ENV variable with for example ${HOSTNAME} in your pipelines.

Grtz

Willem

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