# How to configure datastream and ILM to keep logs for specific time

**URL:** <https://discuss.elastic.co/t/how-to-configure-datastream-and-ilm-to-keep-logs-for-specific-time/272154>\
**Category:** Logs\
**Tags:** ilm-index-lifecycle-management\
**Created:** [May 5, 2021, 9:17am UTC](https://discuss.elastic.co/t/how-to-configure-datastream-and-ilm-to-keep-logs-for-specific-time/272154 "2021-05-05T09:17:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lancer\_enkor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lancer_enkor/32/77527_2.png) [@lancer\_enkor](https://discuss.elastic.co/u/lancer_enkor)\
**Post date:** [May 5, 2021, 9:17am UTC](https://discuss.elastic.co/t/how-to-configure-datastream-and-ilm-to-keep-logs-for-specific-time/272154/1 "2021-05-05T09:17:14Z")

</div>

I want to configure datastream for gathering my application logs. And I want to keep the data from the app for a specific time, let say for one week. I will not use hot-warm-cold architecture, I just want to have logs for one week and then delete it. And I'm struggling with configuring ILM for that.

If I understand it correctly I can setup rollover based on index creation date. So I can set rollover for one day and then setup delete phase with 6 days. But what will happen with index which is already rolled over ? It will still remain searchable within datastream ?

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [May 5, 2021, 9:34am UTC](https://discuss.elastic.co/t/how-to-configure-datastream-and-ilm-to-keep-logs-for-specific-time/272154/2 "2021-05-05T09:34:30Z")

</div>

Hi @lancer_enkor,

that's a good question. In short: yes. A datastream is a concept in Elasticsearch, that is backed by any number of read indices and one write index. A rollover essentially creates a new empty write index and turns the previous write index into a read index. Querying the datastream will query all backing read and write indices. The [datastream docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html#backing-indices) have some nice visuals to explain it better than I could with words.

Does that answer your question?

---

<div class="post-metadata">

**Author:** ![lancer\_enkor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lancer_enkor/32/77527_2.png) [@lancer\_enkor](https://discuss.elastic.co/u/lancer_enkor)\
**Post date:** [May 5, 2021, 11:58am UTC](https://discuss.elastic.co/t/how-to-configure-datastream-and-ilm-to-keep-logs-for-specific-time/272154/3 "2021-05-05T11:58:53Z")

</div>

Yes, thank you for clarification.

---

<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:** [June 2, 2021, 11:59am UTC](https://discuss.elastic.co/t/how-to-configure-datastream-and-ilm-to-keep-logs-for-specific-time/272154/4 "2021-06-02T11:59:24Z")

</div>

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