# How to create index with a date with a template?

**URL:** <https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440>\
**Category:** Kibana\
**Created:** [January 19, 2024, 12:26pm UTC](https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440 "2024-01-19T12:26:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![emoxam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emoxam/32/125661_2.png) [@emoxam](https://discuss.elastic.co/u/emoxam)\
**Post date:** [January 19, 2024, 12:26pm UTC](https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440/1 "2024-01-19T12:26:04Z")

</div>

When i start logstash it creates index with a date, but if i delete this index it creates by the template without any date.  
How to create index with a date with a template ?  
Thanks

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 19, 2024, 1:59pm UTC](https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440/2 "2024-01-19T13:59:43Z")

</div>

> [@emoxam](#):
>
> i start logstash it creates index with a date, but if i delete this index it creates by the template without any date.

Hi,

can you share your logstash config?

Regards

---

<div class="post-metadata">

**Author:** ![emoxam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emoxam/32/125661_2.png) [@emoxam](https://discuss.elastic.co/u/emoxam)\
**Post date:** [January 20, 2024, 11:26am UTC](https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440/4 "2024-01-20T11:26:47Z")

</div>

```auto
input {
  tcp {
    port => 5000
    codec =>plain
  }
}
filter {
  if [message] =~ /actions/ or [message] =~ /172\.16\.10\.78/ or [message] =~ /172\.16\.10\.77/ {
  grok {
    match => [ "message",
               "%{GREEDYDATA:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:data}"
             ]
  }
    date {
      match => ["timestamp" , "yyyy-MM-dd HH:mm:ss,SSS"]
  }
} else {
  }
}
output {
  elasticsearch {
    hosts => "https://localhost:9200"
    ssl_verification_mode => none
    user => "elastic"
    password => "In6FPtXUdPK+i9+Y7skS"
    index => "actions-logs"
    data_stream => false
    ilm_enabled => true
    ilm_policy => "logstash-policy"
    ilm_rollover_alias => "actions-logs"
    ilm_pattern => "{now/d}-000001"
  }
}

```

---

<div class="post-metadata">

**Author:** ![emoxam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emoxam/32/125661_2.png) [@emoxam](https://discuss.elastic.co/u/emoxam)\
**Post date:** [January 22, 2024, 7:56am UTC](https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440/5 "2024-01-22T07:56:44Z")

</div>

Any news ?

---

<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:** [February 19, 2024, 7:57am UTC](https://discuss.elastic.co/t/how-to-create-index-with-a-date-with-a-template/351440/6 "2024-02-19T07:57:36Z")

</div>

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