# Curator - delete everything except a time perioed

**URL:** https://discuss.elastic.co/t/curator-delete-everything-except-a-time-perioed/187946
**Category:** Elasticsearch
**Tags:** curator
**Created:** [June 27, 2019, 11:24pm UTC](https://discuss.elastic.co/t/curator-delete-everything-except-a-time-perioed/187946 "2019-06-27T23:24:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yungnvn](https://avatars.discourse-cdn.com/v4/letter/y/71e660/32.png) [@yungnvn](https://discuss.elastic.co/u/yungnvn)
#### Post date: [June 27, 2019, 11:24pm UTC](https://discuss.elastic.co/t/curator-delete-everything-except-a-time-perioed/187946/1 "2019-06-27T23:24:44Z")

</div>

Hi,

I am trying to delete a certain index past 24 days but keep a certain timeperiod from it. For example,

I want do delete everything older than 24 days but keep stuff from October '18 - December '18.

Here is the config i'm currently using:

> actions:  
> 1:  
> action: delete\_indices  
> description: \>-  
> Delete indices older than 24 days (based on index name), for purgatory-  
> prefixed indices. Ignore the error if the filter does not result in an  
> actionable list of indices (ignore\_empty\_list) and exit cleanly.  
> options:  
> ignore\_empty\_list: True  
> timeout\_override:  
> continue\_if\_exception: False  
> disable\_action: False  
> filters:  
> - filtertype: pattern  
> kind: prefix  
> value: purgatory-  
> exclude:  
> - filtertype: pattern  
> kind: prefix  
> value: purgatory-2018.10-  
> exclude: True  
> - filtertype: pattern  
> kind: prefix  
> value: purgatory-2018.11-  
> exclude: True  
> - filtertype: pattern  
> kind: prefix  
> value: purgatory-2018.12-  
> exclude: True  
> - filtertype: age  
> source: name  
> direction: older  
> timestring: '%Y.%m.%d'  
> unit: days  
> unit\_count: 24  
> exclude:

As you can see, i'm trying to delete anything older than 24 days but keep anything starting with purgatory-2018.10, purgatory-2018.11, purgatory-2018.12. I tried this in QA but hasn't worked.

If anyone has suggestions, any help would be appreciated!

Thanks

---

<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: [June 27, 2019, 11:46pm UTC](https://discuss.elastic.co/t/curator-delete-everything-except-a-time-perioed/187946/2 "2019-06-27T23:46:13Z")

</div>

> [@yungnvn](#):
>
> ```auto
> - filtertype: age
> source: name
> direction: older
> timestring: '%Y.%m.%d'
> 
> ```

> [@yungnvn](#):
>
> ```auto
> - filtertype: pattern
> kind: prefix
> value: purgatory-2018.12-
> exclude: True
> 
> ```

Your `value` for the prefix filter has a `-` at the end, but the `timestring` you're looking for is delimited by periods `.`. I'm guessing that if you changed your values to `purgatory-2018.12.` and similarly for the others, it will actually work the way you want.

---

<div class="post-metadata">

### Author: ![yungnvn](https://avatars.discourse-cdn.com/v4/letter/y/71e660/32.png) [@yungnvn](https://discuss.elastic.co/u/yungnvn)
#### Post date: [June 28, 2019, 5:11pm UTC](https://discuss.elastic.co/t/curator-delete-everything-except-a-time-perioed/187946/3 "2019-06-28T17:11:56Z")

</div>

Ah ! That makes sense. It's working now. Thanks a lot for the 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: [July 26, 2019, 5:12pm UTC](https://discuss.elastic.co/t/curator-delete-everything-except-a-time-perioed/187946/4 "2019-07-26T17:12:03Z")

</div>

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