Logstash : use environment variable
05:35 07 Sep 2017

I have tried to follow the documentation https://www.elastic.co/guide/en/logstash/current/environment-variables.html but it does not seem to work.

I have a bunch of log files to process. Say I have an input file /share/log-2017.09.07.json that I am trying to process with logstash.

An excerpt of my logstash config file is as follows :

input {   file {
     'exclude' => ['*.gz']
     'path' => ["/share/log-${INPUT_DATE}.json"]
     'type' => 'json'
     start_position => "beginning"
     codec  => json
     sincedb_path => "/dev/null"   
  } 
}

I launch logstash as follows :

export INPUT_DATE="2017.09.07"
logstash -f myconfigfile.conf

The logstash does not seem to find the file /share/log-2017.09.03.json. When I replace

     'path' => ["/share/log-${INPUT_DATE}.json"]

by

     'path' => ["/share/log-2017.09.07.json"]

it works.

What am I doing wrong ?

elasticsearch logstash