# Delete index automatically after particular days

**URL:** <https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [October 28, 2021, 5:50am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875 "2021-10-28T05:50:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divya\_Bansal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_bansal/32/81564_2.png) [@Divya\_Bansal](https://discuss.elastic.co/u/Divya_Bansal)\
**Post date:** [October 28, 2021, 5:50am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/1 "2021-10-28T05:50:55Z")

</div>

Hi,

I am using Logstash to ingest log data to Elasticsearch, Indices are created daily, that every day's index has a unique name like `index_name-YYYY-MM-DD` . So, after 30 days, there will be 30 indices. On day 31st, I want the index made at day 1 to get deleted, and on 32nd day, I want 2nd day's index to get deleted.

I had a look at Index Lifecycle Policies. It is showing option through curl but is there any way to do through logtash conf file?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 28, 2021, 6:10am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/2 "2021-10-28T06:10:29Z")

</div>

This is what ILM was designed for. It can not be done through Logstash.

---

<div class="post-metadata">

**Author:** ![Divya\_Bansal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_bansal/32/81564_2.png) [@Divya\_Bansal](https://discuss.elastic.co/u/Divya_Bansal)\
**Post date:** [October 28, 2021, 6:36am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/3 "2021-10-28T06:36:52Z")

</div>

is there any other way to automate the deletion

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 28, 2021, 6:40am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/4 "2021-10-28T06:40:52Z")

</div>

Why do you not want to use ILM? It is what I would recommend.

You could also use Curator, which runs as an external process. This is the old way of managing index lifecycles that ILM is replacing.

---

<div class="post-metadata">

**Author:** ![Divya\_Bansal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_bansal/32/81564_2.png) [@Divya\_Bansal](https://discuss.elastic.co/u/Divya_Bansal)\
**Post date:** [October 28, 2021, 6:44am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/5 "2021-10-28T06:44:37Z")

</div>

I tried using ILM my data is stucked at hot only it does not move to other section

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 28, 2021, 6:46am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/6 "2021-10-28T06:46:04Z")

</div>

Then I would recommend opening a separate thread to solve that issue rather than dismiss ILM. When you do so, make sure you share the full policy as well as node configurations and version information.

---

<div class="post-metadata">

**Author:** ![Divya\_Bansal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_bansal/32/81564_2.png) [@Divya\_Bansal](https://discuss.elastic.co/u/Divya_Bansal)\
**Post date:** [October 28, 2021, 6:47am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/7 "2021-10-28T06:47:39Z")

</div>

okay, thank you

---

<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:** [November 25, 2021, 6:47am UTC](https://discuss.elastic.co/t/delete-index-automatically-after-particular-days/287875/8 "2021-11-25T06:47:59Z")

</div>

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