# Index name not recognize +YYYY.MM.dd some times

**URL:** <https://discuss.elastic.co/t/index-name-not-recognize-yyyy-mm-dd-some-times/224140>\
**Category:** Logstash\
**Tags:** ilm-index-lifecycle-management\
**Created:** [March 18, 2020, 3:50pm UTC](https://discuss.elastic.co/t/index-name-not-recognize-yyyy-mm-dd-some-times/224140 "2020-03-18T15:50:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Antonio\_Arenas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_antonio_arenas/32/45922_2.png) [@Jose\_Antonio\_Arenas](https://discuss.elastic.co/u/Jose_Antonio_Arenas)\
**Post date:** [March 18, 2020, 3:50pm UTC](https://discuss.elastic.co/t/index-name-not-recognize-yyyy-mm-dd-some-times/224140/1 "2020-03-18T15:50:02Z")

</div>

Hi,  
When I try to create an index in logstash output using:

```auto
elasticsearch {
  hosts => "myelasticsearch:9200"
  index => "my_index-%{+YYYY.MM.dd}"
}

```

In the log of elasticsearch the name of the index is "my\_index-" and not appear the date.

Any idea?

Thanks.

---

<div class="post-metadata">

**Author:** ![Jose\_Antonio\_Arenas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_antonio_arenas/32/45922_2.png) [@Jose\_Antonio\_Arenas](https://discuss.elastic.co/u/Jose_Antonio_Arenas)\
**Post date:** [March 19, 2020, 11:08am UTC](https://discuss.elastic.co/t/index-name-not-recognize-yyyy-mm-dd-some-times/224140/2 "2020-03-19T11:08:04Z")

</div>

I am confused because

```auto
output {
 if "_grokparsefailure" not in [tags] {
   file {
     path => "./logs/%{[fields][app_id]}-grok-%{+YYYY.MM.dd}.log"
   }
 } else {
   file {
     path => "./logs/%{[fields][app_id]}-grokparsefailure-%{+YYYY.MM.dd}.log"
   }
 }
}

```

And this is the result:

```auto
[2020-03-19T12:11:32,785][INFO][logstash.outputs.file][main] Opening file {:path=>"/home/elastic/logstash-7.5.2/logs/squid-grok-.log"}

[2020-03-19T12:11:42,502][INFO][logstash.outputs.file][main] Opening file {:path=>"/home/elastic/logstash-7.5.2/logs/squid-grokparsefailure-2020.03.19.log"}
[2020-03-19T12:11:43,462][INFO][logstash.outputs.file][main] Closing file /home/elastic/logstash-7.5.2/logs/squid-grok-.log
[2020-03-19T12:11:53,568][INFO][logstash.outputs.file][main] Closing file /home/elastic/logstash-7.5.2/logs/squid-grokparsefailure-2020.03.19.log

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2020, 11:08am UTC](https://discuss.elastic.co/t/index-name-not-recognize-yyyy-mm-dd-some-times/224140/3 "2020-04-16T11:08:07Z")

</div>

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