# ILM policy for .monitoring indexes

**URL:** https://discuss.elastic.co/t/ilm-policy-for-monitoring-indexes/285433
**Category:** Kibana
**Tags:** elastic-stack-monitoring, ilm-index-lifecycle-management
**Created:** [September 29, 2021, 6:06am UTC](https://discuss.elastic.co/t/ilm-policy-for-monitoring-indexes/285433 "2021-09-29T06:06:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dabo/32/95229_2.png) [@dabo](https://discuss.elastic.co/u/dabo)
#### Post date: [September 29, 2021, 6:06am UTC](https://discuss.elastic.co/t/ilm-policy-for-monitoring-indexes/285433/1 "2021-09-29T06:06:17Z")

</div>

Hi, How do I properly set up an ILM policy for `.monitoring-*` indexes?

- When I create a policy and add it to the index templates I get some error about `rollover_alias`
- Then when I add rollover alias and I get another error that it doesn't point to that index
- Then I add `alias` to the index template (that matches the rollover alias), then there is another error that it is not pointing to a `write` index

So basically I should not add alias to the template but kickstart the index with alias and as a write index. But how to do that when indexes are already existing?

---

<div class="post-metadata">

### Author: ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)
#### Post date: [October 1, 2021, 9:59am UTC](https://discuss.elastic.co/t/ilm-policy-for-monitoring-indexes/285433/2 "2021-10-01T09:59:37Z")

</div>

This seems very helpful:  
[Ilm policy on system index - #2 by jakelandis](https://discuss.elastic.co/t/ilm-policy-on-system-index/183657/2)

And for the reference issue to have ilm for monitoring indices out of the box: [Use ILM to manage internal indices · Issue #38470 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/38470)

---

<div class="post-metadata">

### Author: ![dabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dabo/32/95229_2.png) [@dabo](https://discuss.elastic.co/u/dabo)
#### Post date: [October 4, 2021, 6:51am UTC](https://discuss.elastic.co/t/ilm-policy-for-monitoring-indexes/285433/3 "2021-10-04T06:51:13Z")

</div>

Thanks you for help.  
I tried suggested and it didn't help.

I created:

```auto
PUT _template/.monitoring
{
  "order": 10,
  "index_patterns": [".monitoring-*"],
  "settings": {
    "index.lifecycle.name": ".monitoring"
  }
}

```

Now getting `illegal_argument_exception: index.lifecycle.rollover_alias [metricbeat-7.4.2] does not point to index [metricbeat-7.4.2-2021.10.01]` on all .monitoring indexes.

If I now try to add rollover alias then I guess I would be back to the issue described above.

Any idea what I'm doing wrong?  
Should I revers the order of templates? My "monitoring" template has order:10 and other default monitoring templates all have order:0.

Kind regards,  
Dane

---

<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 1, 2021, 6:52am UTC](https://discuss.elastic.co/t/ilm-policy-for-monitoring-indexes/285433/4 "2021-11-01T06:52:01Z")

</div>

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