# Date pattern in file input path

**URL:** <https://discuss.elastic.co/t/date-pattern-in-file-input-path/100538>\
**Category:** Logstash\
**Created:** [September 14, 2017, 12:55pm UTC](https://discuss.elastic.co/t/date-pattern-in-file-input-path/100538 "2017-09-14T12:55:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [September 14, 2017, 1:44pm UTC](https://discuss.elastic.co/t/date-pattern-in-file-input-path/100538/3 "2017-09-14T13:44:19Z")

</div>

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}"

---

_[View the full topic](https://discuss.elastic.co/t/date-pattern-in-file-input-path/100538)._
