# Need to implement a Lifecycle, but I have daily named indicies

**URL:** https://discuss.elastic.co/t/need-to-implement-a-lifecycle-but-i-have-daily-named-indicies/207945
**Category:** Elasticsearch
**Created:** [November 14, 2019, 5:47pm UTC](https://discuss.elastic.co/t/need-to-implement-a-lifecycle-but-i-have-daily-named-indicies/207945 "2019-11-14T17:47:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mhare](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mhare/32/52213_2.png) [@mhare](https://discuss.elastic.co/u/mhare)
#### Post date: [November 14, 2019, 5:47pm UTC](https://discuss.elastic.co/t/need-to-implement-a-lifecycle-but-i-have-daily-named-indicies/207945/1 "2019-11-14T17:47:56Z")

</div>

I hope I'm just not seeing something. I have version 7.4 of the Elastic Stack  
Logstash creates indices as:  
output {  
elasticsearch {  
action =\> "index"  
hosts =\> ["localhost:9200"]  
index =\> "memleak-%{+YYYY.MM.dd}"  
workers =\> 1  
}  
for 9 different inputs (the 'memleak' part of the index name changes for each input, but otherwise the same)

So, I get a new index every day. Now I am finding I need to implement a lifecycle policy so I can age out old data.  
I created a simple policy to delete data after 45 days of creation.  
But I have to apply this policy to each index. And since a new indices are created everyday, I have to apply the policy to the new indices everyday?

---

<div class="post-metadata">

### Author: ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)
#### Post date: [November 14, 2019, 5:55pm UTC](https://discuss.elastic.co/t/need-to-implement-a-lifecycle-but-i-have-daily-named-indicies/207945/2 "2019-11-14T17:55:00Z")

</div>

I think you can apply your ILM policy via a template. More than one template can be applied at index creation (in ascending priority order).

For example, if you had an ILM policy "delete-at-45" that just had a delete phase, you could create a template with just that ILM setting but index patterns matching "memleak-\*" and it's relation. Any other templates would still contribute their mappings and settings.

ILM is designed for more than this (rollover), but I think you can do this subset of ILM function.

---

<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: [December 12, 2019, 5:55pm UTC](https://discuss.elastic.co/t/need-to-implement-a-lifecycle-but-i-have-daily-named-indicies/207945/3 "2019-12-12T17:55:01Z")

</div>

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