Reading environmental values in logstash config file in input/output

Is there a way to read environmental values in logstash config file . I want to pass in an env value to write test cases for my logstash configs
For ex I want to do the following in my logstash config file

input {
 if [ $ENV_VALUE] = test {
    stdin{}
}else{
    Default config
}
}
filter {..}
output
{
 if [ $ENV_VALUE] = test {
  stdout { codec => rubydebug }
}else{
   Default config
}

}
1 Like

I was going suggest using an environment filter here but since you want to wrap inputs with conditionals that's probably not going to fly. I suggest you extract your inputs and outputs into separate files and choose which ones to include when you invoke Logstash.

I know this isn't exactly what your looking for but check out this
suggestion:

@Joe_Lawson , thanks for the link.

I think i will rather use logstash with a dynamic string as an input instead of a file name to achieve my functionality , which is @magnusbaeck suggestion