# Lifecycle Management rotate on a daily basis

**URL:** <https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263>\
**Category:** Elasticsearch\
**Created:** [March 28, 2019, 8:11am UTC](https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263 "2019-03-28T08:11:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gruselglatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gruselglatz/32/42675_2.png) [@gruselglatz](https://discuss.elastic.co/u/gruselglatz)\
**Post date:** [March 28, 2019, 8:11am UTC](https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263/1 "2019-03-28T08:11:09Z")

</div>

How do i correctly config ILM to rotate my index on a daily basis and delete the index after 120 days?

I tried this config, but it doesn't rotated the index:

```
"logstash" : {
    "version" : 1,
    "modified_date" : "2019-03-27T11:42:32.848Z",
    "policy" : {
      "phases" : {
        "warm" : {
          "min_age" : "14d",
          "actions" : {
            "allocate" : {
              "number_of_replicas" : 0,
              "include" : { },
              "exclude" : { },
              "require" : { }
            }
          }
        },
        "hot" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_size" : "50gb",
              "max_age" : "1d"
            }
          }
        },
        "delete" : {
          "min_age" : "120d",
          "actions" : {
            "delete" : { }
          }
        }
      }
    }
  }
```

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [March 29, 2019, 1:17pm UTC](https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263/2 "2019-03-29T13:17:46Z")

</div>

Hi Gruselglatz,

The policy looks correct to me, can you use the [ILM Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/ilm-explain-lifecycle.html) on the index to see what's going on, should be:

```auto
GET /<index-name>/_ilm/explain?pretty&human

```

This will give us an idea of where the policy is and whether it's hit any errors while executing.

---

<div class="post-metadata">

**Author:** ![gruselglatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gruselglatz/32/42675_2.png) [@gruselglatz](https://discuss.elastic.co/u/gruselglatz)\
**Post date:** [April 1, 2019, 5:40am UTC](https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263/3 "2019-04-01T05:40:52Z")

</div>

Hi dakrone!

it looks like its rotating now, but with one day delay.  
I get this now:

Real Date -\> index name  
28.03.2019 -\> logstash-2019.03.27-000001  
29.03.2019 -\> logstash-2019.03.28-000002  
30.03.2019 -\> logstash-2019.03.29-000003  
31.03.2019 -\> logstash-2019.03.30-000004  
01.04.2019 -\> logstash-2019.03.31-000005

but what i want to get is:  
Real Date -\> index name  
28.03.2019 -\> logstash-2019.03.28-000001  
29.03.2019 -\> logstash-2019.03.29-000001  
30.03.2019 -\> logstash-2019.03.30-000001  
31.03.2019 -\> logstash-2019.03.31-000001  
01.04.2019 -\> logstash-2019.04.01-000001

And when i get over xx million docs the index should rotate on the same day and increment the last number.

the output of the API-call:

```
GET /logstash-2019.03.31-000005/_ilm/explain?pretty&human

{
  "indices" : {
    "logstash-2019.03.31-000005" : {
      "index" : "logstash-2019.03.31-000005",
      "managed" : true,
      "policy" : "logstash",
      "lifecycle_date" : "2019-03-31T13:19:44.376Z",
      "lifecycle_date_millis" : 1554038384376,
      "phase" : "hot",
      "phase_time" : "2019-03-31T13:19:44.477Z",
      "phase_time_millis" : 1554038384477,
      "action" : "rollover",
      "action_time" : "2019-03-31T13:29:44.419Z",
      "action_time_millis" : 1554038984419,
      "step" : "check-rollover-ready",
      "step_time" : "2019-03-31T13:29:44.419Z",
      "step_time_millis" : 1554038984419,
      "phase_execution" : {
        "policy" : "logstash",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_size" : "50gb",
              "max_age" : "1d"
            }
          }
        },
        "version" : 1,
        "modified_date" : "2019-03-27T11:42:32.848Z",
        "modified_date_in_millis" : 1553686952848
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![gruselglatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gruselglatz/32/42675_2.png) [@gruselglatz](https://discuss.elastic.co/u/gruselglatz)\
**Post date:** [April 9, 2019, 5:06am UTC](https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263/4 "2019-04-09T05:06:13Z")

</div>

@dakrone do you know something new? I think it should be fixable by configuring the rotation time to midnight every day and not 1PM afternoon.

how could I achieve it?

---

<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:** [May 7, 2019, 5:06am UTC](https://discuss.elastic.co/t/lifecycle-management-rotate-on-a-daily-basis/174263/5 "2019-05-07T05:06:17Z")

</div>

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