# Old .monitoring indices aren't being deleted

**URL:** https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436
**Category:** Elasticsearch
**Created:** [August 21, 2018, 5:23pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436 "2018-08-21T17:23:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![oblakeerickson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oblakeerickson/32/34602_2.png) [@oblakeerickson](https://discuss.elastic.co/u/oblakeerickson)
#### Post date: [August 21, 2018, 5:23pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436/1 "2018-08-21T17:23:42Z")

</div>

I'm having a similar issue as this topic where old monitoring indices aren't being deleted:

> [@Deleting Old Monitoring Indices](https://discuss.elastic.co/t/deleting-old-monitoring-indices/90987/2):
>
> Hi crickes, The automatic deletion of old monitoring indices is available only for exporters of type local and the retention duration can be configured using the setting xpack.monitoring.history.duration if you have a non-basic license (see [https://www.elastic.co/guide/en/x-pack/current/monitoring-settings.html#monitoring-collection-settings](https://www.elastic.co/guide/en/x-pack/current/monitoring-settings.html#monitoring-collection-settings)). This feature is not available when using http exporters, in this case you can use Curator.

But we are using exporters of type local as far as I know because the monitoring indices are on the same nodes as our other indices. We are using elasticsearch 6 and a basic license.

We are actually running elasticsearch in many different env and this issue is only happening in one of those environments. In other environments the monitoring indices are being deleted after 7 days.

I feel like this elasticsearch cluster in this env got into a weird state somehow since its working fine in all the other environments. Is there something I can check/verify to get this working again? I know I can simply setup curator to run via a cron job because we are already doing this for non-monitoring indices.

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 21, 2018, 5:41pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436/2 "2018-08-21T17:41:31Z")

</div>

I updated the title to reflect that this is exclusive to the `.monitoring-*` indices.

I don't have any clear insights to why they might not be deleting automatically, unless the settings that enable/disable this have been configured, or a longer-than-7 day retention period is configured.

---

<div class="post-metadata">

### Author: ![oblakeerickson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oblakeerickson/32/34602_2.png) [@oblakeerickson](https://discuss.elastic.co/u/oblakeerickson)
#### Post date: [August 21, 2018, 5:58pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436/3 "2018-08-21T17:58:01Z")

</div>

> [@theuntergeek](#):
>
> unless the settings that enable/disable this have been configured, or a longer-than-7 day retention period is configured.

I'm pretty sure with a basic license you can't configure these settings anyways?

> [@Why auto delete the monitoring data(7 days) about es and kibana how to change it](https://discuss.elastic.co/t/why-auto-delete-the-monitoring-data-7-days-about-es-and-kibana-how-to-change-it/103281/4):
>
> The default value is _7 days_ for all licenses.  
> The ability to configure that setting only exists in Gold or Platinum.

In our elasticsearch.yml we don't have any monitoring related settings set.

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [August 21, 2018, 5:58pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436/4 "2018-08-21T17:58:54Z")

</div>

I'm not sure what's happened, then.

---

<div class="post-metadata">

### Author: ![oblakeerickson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oblakeerickson/32/34602_2.png) [@oblakeerickson](https://discuss.elastic.co/u/oblakeerickson)
#### Post date: [August 21, 2018, 6:24pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436/5 "2018-08-21T18:24:23Z")

</div>

Okay I just found another piece of the puzzle. For some reason we are getting a license expired (I'm assuming some x-pack thing?) in the environment and not on the others. But a key line of the license expired elasticsearch logs output is:

> `The agent will stop automatically cleaning indices older than [xpack.monitoring.history.duration]`

So that is probably what is causing the .monitoring indices to not be deleted. I'll look into the license expired issue and see what I can figure out.

---

<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: [September 18, 2018, 6:24pm UTC](https://discuss.elastic.co/t/old-monitoring-indices-arent-being-deleted/145436/6 "2018-09-18T18:24:28Z")

</div>

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