Date pattern in file input path

Depending on your platform you might be able to set an environment variable to the name and then reference that in the config. For example, I have a nightly job that processes the prior day index. In the script that runs I set

 INDEXDATE=`date --date="-1 day" '+%Y.%m.%d'`

and in the logstash configuration I have an elasticsearch input that reads

index => "logstash-${INDEXDATE}"

1 Like