# ISM Policy not deleting logs

**URL:** <https://forum.opensearch.org/t/ism-policy-not-deleting-logs/6552>\
**Category:** Index Management\
**Created:** [July 19, 2021, 8:58pm UTC](https://forum.opensearch.org/t/ism-policy-not-deleting-logs/6552 "2021-07-19T20:58:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oxie](https://avatars.discourse-cdn.com/v4/letter/o/9fc29f/32.png) [@Oxie](https://forum.opensearch.org/u/Oxie)\
**Post date:** [July 19, 2021, 8:58pm UTC](https://forum.opensearch.org/t/ism-policy-not-deleting-logs/6552/1 "2021-07-19T20:58:25Z")

</div>

I’m using AWS managed ElasticSearch v 7.10 (single instance)

I’ve created a policy to delete indices older than two days:

```auto
PUT _opendistro/_ism/policies/delete_debug_logs_after_2days
{
    "policy": {
        "description": "Delete debug indices after 2 days",
        "default_state": "Open",
        "schema_version": 1,
        "states": [
            {
                "name": "Open",
                "actions": [
                    {
                        "open": {}
                    }
                ],
                "transitions": [
                    {
                        "state_name": "Delete",
                        "conditions": {
                            "min_index_age": "2d"
                        }
                    }
                ]
            },            
            {
                "name": "Delete",
                "actions": [
                    {
                        "delete": {}
                    }
                ]
            }
        ],
        "ism_template": {
          "index_patterns": ["logs-d-*"],
          "priority": 100
        }
    }
  }
}

```

I also want to apply the policy to the existing indices using this request:

```auto
POST _opendistro/_ism/add/logs-d-*
{
  "policy_id": "delete_debug_logs_after_2days"
}

```

When I add the policy to existing indices, on “Index Management/Policy managed indices” page in Kibana the indices correctly appear in the list, and the Job status is Running, the Action info column has “Successfully initialized policy…”, and the policy state name is Open. The storage tier of those indices is shown as Hot/Warm. It doesn’t seem to progress any further.

I’m not sure if the first state action is correct - could you please advise?  
How can I resolve it please so that the indices are deleted?

Thanks.

---

<div class="post-metadata">

**Author:** ![kris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/kris/32/2208_2.png) [@kris](https://forum.opensearch.org/u/kris)\
**Post date:** [February 7, 2023, 5:17pm UTC](https://forum.opensearch.org/t/ism-policy-not-deleting-logs/6552/2 "2023-02-07T17:17:43Z")

</div>

Closed on February 7, 2023, 5:17pm UTC


