# Purging the index using curator script

**URL:** https://discuss.elastic.co/t/purging-the-index-using-curator-script/304478
**Category:** Elasticsearch
**Tags:** curator
**Created:** [May 11, 2022, 2:58pm UTC](https://discuss.elastic.co/t/purging-the-index-using-curator-script/304478 "2022-05-11T14:58:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)
#### Post date: [May 11, 2022, 2:58pm UTC](https://discuss.elastic.co/t/purging-the-index-using-curator-script/304478/1 "2022-05-11T14:58:21Z")

</div>

HI,  
I'm using curator script to purge our data in production.

Currently we are having 2 type of format in ES once is for Production index and another one is pre-prod index.

Basically we keep last 5 week records of production logs and 2 week records of pre-prod logs. we are performing this manually.

By using of below script i could purge both production and pre-prod log more than 5 weeks.

could anyone help me to delete 5 weeks prod log and 2 week per-prod logs.

test-pr-logstash-2022.weekly = production index format  
test-na-logstash-2022.weekly = pre-prod index format

```auto
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 30 days (based on index name), for all
      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
      allow_ilm_indices: True
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y.%W'
      unit: weeks
      unit_count: 5
      exclude:

```

---

<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 8, 2022, 2:58pm UTC](https://discuss.elastic.co/t/purging-the-index-using-curator-script/304478/2 "2022-06-08T14:58:24Z")

</div>

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