# Is there a way to apply a lifecycle management policy only to metricbeat-\* pattern index?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-apply-a-lifecycle-management-policy-only-to-metricbeat-pattern-index/204337>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 20, 2019, 7:22am UTC](https://discuss.elastic.co/t/is-there-a-way-to-apply-a-lifecycle-management-policy-only-to-metricbeat-pattern-index/204337 "2019-10-20T07:22:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mai\_Waly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mai_waly/32/53763_2.png) [@Mai\_Waly](https://discuss.elastic.co/u/Mai_Waly)\
**Post date:** [October 20, 2019, 7:22am UTC](https://discuss.elastic.co/t/is-there-a-way-to-apply-a-lifecycle-management-policy-only-to-metricbeat-pattern-index/204337/1 "2019-10-20T07:22:29Z")

</div>

Is there a way to apply a life cycle management policy only to metricbeat-\* pattern index in 7.4 logstash/Elasticsearch/kibana cluster to delete any index older than 30 days?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 20, 2019, 9:33am UTC](https://discuss.elastic.co/t/is-there-a-way-to-apply-a-lifecycle-management-policy-only-to-metricbeat-pattern-index/204337/2 "2019-10-20T09:33:38Z")

</div>

Yes possible, check theses links

[https://www.elastic.co/guide/en/beats/metricbeat/current/ilm.html](https://www.elastic.co/guide/en/beats/metricbeat/current/ilm.html)  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html)

---

<div class="post-metadata">

**Author:** ![Mai\_Waly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mai_waly/32/53763_2.png) [@Mai\_Waly](https://discuss.elastic.co/u/Mai_Waly)\
**Post date:** [October 20, 2019, 11:39am UTC](https://discuss.elastic.co/t/is-there-a-way-to-apply-a-lifecycle-management-policy-only-to-metricbeat-pattern-index/204337/3 "2019-10-20T11:39:55Z")

</div>

Thanks, here is what I have done

- Created a new lifecycle management policy named it metricbeat\_cleaup that delete index every 7days
- Create a new index template that associate new created daily index to my policy

PUT \_template/metricbeat\_template  
{  
"index\_patterns": ["metricbeat-\*"],  
"settings": {  
"number\_of\_shards": 3,  
"index.lifecycle.name": "metricbeat\_cleanup"

}  
}

Will be monitoring if all went Ok.

Thanks for your help

---

<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 17, 2019, 11:40am UTC](https://discuss.elastic.co/t/is-there-a-way-to-apply-a-lifecycle-management-policy-only-to-metricbeat-pattern-index/204337/4 "2019-11-17T11:40:04Z")

</div>

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