# Policy based on a term

**URL:** <https://discuss.elastic.co/t/policy-based-on-a-term/223495>\
**Category:** Elasticsearch\
**Created:** [March 13, 2020, 11:36am UTC](https://discuss.elastic.co/t/policy-based-on-a-term/223495 "2020-03-13T11:36:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [March 13, 2020, 11:36am UTC](https://discuss.elastic.co/t/policy-based-on-a-term/223495/1 "2020-03-13T11:36:44Z")

</div>

I am ingesting logs which has very high verbosity, in order to cope with the high number of documents I wanted to create a policy in the index lifecyle, rolling over to cold an index after certain number of documents or size is fine, but what I want is that only the documents that are DEBUG or TRACE as they are the 90% of the logs, they roll to be in the phase of delete and keep the rest WARN, FATAL etc for longer.  
I could just remove the high verbosity but I need to keep the high verbosity for at least 1 week at all times.  
Is there a way to do a query in the policy?

---

<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:** [March 13, 2020, 11:38am UTC](https://discuss.elastic.co/t/policy-based-on-a-term/223495/2 "2020-03-13T11:38:20Z")

</div>

You need to split the different log types into different indices as retention is managed at the index level.

---

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [March 13, 2020, 11:41am UTC](https://discuss.elastic.co/t/policy-based-on-a-term/223495/3 "2020-03-13T11:41:20Z")

</div>

Oh true! I didn't think it like that! I can split the pipeline in logstash for that.  
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:** [April 10, 2020, 11:41am UTC](https://discuss.elastic.co/t/policy-based-on-a-term/223495/4 "2020-04-10T11:41:22Z")

</div>

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