index-management icon indicating copy to clipboard operation
index-management copied to clipboard

I have create a index roll-over and delete policy but data not deleted

Open dipenpatel235 opened this issue 2 years ago • 8 comments

Describe the bug policy has been apply but data not deleted.

please look at policy..

{ "policy": { "policy_id": "Data-rollover", "description": "hot warm delete workflow", "last_updated_time": 1657718012858, "schema_version": 12, "error_notification": null, "default_state": "hot", "states": [ { "name": "hot", "actions": [ { "rollover": { "min_index_age": "1d" } } ], "transitions": [ { "state_name": "warm" } ] }, { "name": "warm", "actions": [ { "replica_count": { "number_of_replicas": 0 } } ], "transitions": [ { "state_name": "delete", "conditions": { "min_index_age": "30d" } } ] }, { "name": "delete", "actions": [ { "notification": { "destination": { "slack": { "url": "<URL>" } }, "message_template": { "source": "The index {{ctx.index}} is being deleted", "lang": "mustache" } } }, { "delete": {} } ], "transitions": [] } ], "ism_template": [ { "index_patterns": [ "abc", "xyz" ], "priority": 100, "last_updated_time": 1657718012858 } ] } }

I also attached screenshort please look at.

image

dipenpatel235 avatar Jul 13 '22 13:07 dipenpatel235

Can check the ISM running status using explain API, it will show what state your managed index is in and whether it any ISM action failed because of some exception.

bowenlan-amzn avatar Jul 14 '22 22:07 bowenlan-amzn

@bowenlan-amzn

when i am running the explain API query getting following response

image

dipenpatel235 avatar Aug 01 '22 06:08 dipenpatel235

Can you give the explain result for the problem index, not this 08.01 which seems to be the latest index created today.

On the frontend, there's a Policy managed indices page, from that page, you can also see the ISM running status (explain API response) for your index.

bowenlan-amzn avatar Aug 01 '22 17:08 bowenlan-amzn

@bowenlan-amzn Hello, I have attached older than 30 days index. Kindly check it

image

dipenpatel235 avatar Aug 08 '22 06:08 dipenpatel235

Sorry for losing track on this.

Lemme provide you some more tools to figure out what's going on

  1. ISM runs action using a fixed-time interval scheduled job, the interval of job is controlled by a cluster setting plugins.index_state_management.job_interval, default to 5m. So you have an estimate of the running frequency and can look for ISM related logs in opensearch.log.
  2. For each index that's being managed, we saved a managed_index job document into our configuration index opendistro-ism-config. So you can query the config index for the managed_index job of your index, to see if it's enabled (running). During running, we also saved managed_index_metadata document which record the current running status like which state, action, step ISM is doing.
    • Here are the mapping of our configuration index for you write your query. An example query is like:
GET .opendistro-ism-config/_search
{
  "query": {
    "exists": {
      "field": "managed_index"
    }
  }
}

bowenlan-amzn avatar Nov 04 '22 19:11 bowenlan-amzn

Hi, facing the same problem, i'm on ODFE(selfhosted openserch) @dipenpatel235 did you found a solution? @bowenlan-amzn more tools that you provided didn't helped to solve the problem.

Maksat2022 avatar Feb 06 '23 07:02 Maksat2022

had the same issue. after re-applying the policy, the indices have been deleted

jazzl0ver avatar Mar 29 '23 11:03 jazzl0ver

For me indexes are deleted but not on the certain time I gave. I gave 10 sec to get deleted but it is taking lot of time to initialise and then to perform the action.

Here is my policy:

{
    "policy_id": "log_policy_for_delete",
    "description": "delete after 10s",
    "last_updated_time": 1695921405668,
    "schema_version": 18,
    "error_notification": null,
    "default_state": "delete",
    "states": [
        {
            "name": "hold",
            "actions": [],
            "transitions": [
                {
                    "state_name": "delete",
                    "conditions": {
                        "min_index_age": "10s"
                    }
                }
            ]
        },
        {
            "name": "delete",
            "actions": [
                {
                    "retry": {
                        "count": 3,
                        "backoff": "exponential",
                        "delay": "1m"
                    },
                    "delete": {}
                }
            ],
            "transitions": []
        }
    ],
    "ism_template": [
        {
            "index_patterns": [
                "aman*"
            ],
            "priority": 1,
            "last_updated_time": 1695921405668
        }
    ]
}

Screenshot 2023-09-28 at 11 01 24 PM

mramanindia avatar Sep 28 '23 17:09 mramanindia