# How to prevent automatic deletion of indices

**URL:** <https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965>\
**Category:** Logstash\
**Tags:** ilm-index-lifecycle-management\
**Created:** [September 12, 2021, 6:47am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965 "2021-09-12T06:47:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asan](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@asan](https://discuss.elastic.co/u/asan)\
**Post date:** [September 12, 2021, 6:47am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965/1 "2021-09-12T06:47:53Z")

</div>

hi  
After checking history of my logs in Discovery i found out that my logs just stored for 2 weeks and after that history of my logs is deleted. i didn't set up any policy in Index Lifecycle Policies. how can i fix this problem to keep my logs more then 2 weeks?

thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 13, 2021, 5:35am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965/2 "2021-09-13T05:35:06Z")

</div>

What version of the stack are you on?  
What logs are you referring to?  
Are you sure they don't have ILM policies applied to them, check using [Get index lifecycle management status API | Elasticsearch Guide [7.14] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html).

---

<div class="post-metadata">

**Author:** ![asan](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@asan](https://discuss.elastic.co/u/asan)\
**Post date:** [September 13, 2021, 9:16am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965/3 "2021-09-13T09:16:14Z")

</div>

hi Warkolm  
i think if found the reason of this issue. I found script in /opt/selks/delete-old-logs.sh i just modified the unit\_count to 1 years:

```auto
#!/bin/bash

/usr/bin/curator_cli delete_indices --filter_list '
[
  {
    "filtertype": "age",
    "source": "creation_date",
    "direction": "older",
    "unit": "days",
    "unit_count":365
  },
  {
    "filtertype": "pattern",
    "kind": "prefix",
    "value": "logstash*"
  }
]
'

```

this script deleted all history of logstash-\* indices and i and i executed GET /\_ilm/status command my ilm status was running :

```auto
{
  "operation_mode" : "RUNNING"
}

```

should i stop it? i don't think it will fix my issue because just for your information i didn't configure any Alias for my indices then as you know you can assign any policy to your indices

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 13, 2021, 9:32am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965/4 "2021-09-13T09:32:17Z")

</div>

Don't stop it, that wouldn't have been deleting your logs.

---

<div class="post-metadata">

**Author:** ![asan](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@asan](https://discuss.elastic.co/u/asan)\
**Post date:** [September 14, 2021, 4:45am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965/5 "2021-09-14T04:45:32Z")

</div>

By the way thanks for your reply. 🌻

---

<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:** [October 12, 2021, 4:45am UTC](https://discuss.elastic.co/t/how-to-prevent-automatic-deletion-of-indices/283965/6 "2021-10-12T04:45:56Z")

</div>

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