# Index lifecycle create index every day

**URL:** <https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471>\
**Category:** Kibana\
**Created:** [July 1, 2020, 11:29am UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471 "2020-07-01T11:29:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [July 1, 2020, 11:29am UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/1 "2020-07-01T11:29:47Z")

</div>

Hello,

Is there a way to create new index in index lifecycle manager every day without taking in count the size of the index or other factors?

Regards.  
Peter

---

<div class="post-metadata">

**Author:** ![Thomas74](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Thomas74](https://discuss.elastic.co/u/Thomas74)\
**Post date:** [July 1, 2020, 12:31pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/2 "2020-07-01T12:31:43Z")

</div>

Hi Peter,

You can set a max\_age to your rollover ILM policy.

From the documentation :

[https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html)

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [July 1, 2020, 12:57pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/3 "2020-07-01T12:57:52Z")

</div>

I have this set in the ILP and it doesn't seam to work:

 ![Screenshot 2020-07-01 at 15.57.04](https://us1.discourse-cdn.com/elastic/original/3X/b/5/b5cda8f4cd7074f1e5b182c25f66a6ce9f0772c0.png)

---

<div class="post-metadata">

**Author:** ![Thomas74](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Thomas74](https://discuss.elastic.co/u/Thomas74)\
**Post date:** [July 1, 2020, 1:02pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/4 "2020-07-01T13:02:03Z")

</div>

Have you try to change your ILM config via the Dev Tool ?

What result you have when you get your ILM policy from it too ?

The UI is great for common things but to me more precise, I perfer, personnaly, use the API.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [July 1, 2020, 1:11pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/5 "2020-07-01T13:11:59Z")

</div>

When the policy will be executed?

---

<div class="post-metadata">

**Author:** ![Thomas74](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Thomas74](https://discuss.elastic.co/u/Thomas74)\
**Post date:** [July 1, 2020, 1:21pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/6 "2020-07-01T13:21:44Z")

</div>

Elasticearch will check the state of their policy every X seconds/minutes. If I remember well it something like every 15 minutes.

The rolling will be executed after all conditions are filled.

If you configured it correctly, normally every day.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [July 1, 2020, 1:25pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/7 "2020-07-01T13:25:10Z")

</div>

this is what I get from the dev tools:

```auto
    {
      "metricbeat-7.5.0" : {
        "version" : 7720,
        "modified_date" : "2020-07-01T12:56:52.945Z",
        "policy" : {
          "phases" : {
            "hot" : {
              "min_age" : "0ms",
              "actions" : {
                "rollover" : {
                  "max_size" : "50gb",
                  "max_age" : "24h"
                }
              }
            }
          }
        }
      }
    }

```

---

<div class="post-metadata">

**Author:** ![Thomas74](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Thomas74](https://discuss.elastic.co/u/Thomas74)\
**Post date:** [July 1, 2020, 1:54pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/8 "2020-07-01T13:54:01Z")

</div>

You can try something like this config :

```auto
   PUT _ilm/policy/my_policy
   {
     "policy": {
       "phases": {
         "hot": {                      
           "actions": {
             "rollover": { 
               "max_age": "1d"
             }
           }
         }
       }
     }
   } 

```

You can also inspire you from there :

[https://www.elastic.co/guide/en/elasticsearch/reference/current/set-up-lifecycle-policy.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/set-up-lifecycle-policy.html)

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [July 1, 2020, 2:22pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/9 "2020-07-01T14:22:29Z")

</div>

> [@Thomas74](#):
>
> ```auto
> PUT _ilm/policy/my_policy
> {
> "policy": {
> "phases": {
> "hot": {                      
> "actions": {
> "rollover": { 
> "max_age": "1d"
> }
> }
> }
> }
> }
> } 
> 
> ```

I've run this ilm config:

```auto
PUT _ilm/policy/packetbeat-7.5.0
   {
     "policy": {
       "phases": {
         "hot": {                      
           "actions": {
             "rollover": { 
               "max_age": "12h"
             }
           }
         }
       }
     }
   } 

```

When I look in the last index for packetbeat. I see the following:

```auto
  "indices" : {
    "packetbeat-7.5.0-2020.06.30-000007" : {
      "index" : "packetbeat-7.5.0-2020.06.30-000007",
      "managed" : true,
      "policy" : "packetbeat-7.5.0",
      "lifecycle_date_millis" : 1593546261570,
      "age" : "18.66h",
      "phase" : "hot",
      "phase_time_millis" : 1593546263292,
      "action" : "rollover",
      "action_time_millis" : 1593546861946,
      "step" : "check-rollover-ready",
      "step_time_millis" : 1593546861946,
      "phase_execution" : {
        "policy" : "packetbeat-7.5.0",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_size" : "50gb",
              "max_age" : "30d"
            }
          }
        },
        "version" : 4,
        "modified_date_in_millis" : 1590153720816
      }
    }
  }
}

```

Does that mean that no matter what the polity was updated to the index will roll over only when it reaches 50G or 30days old, and only the newly created index will get the policies configured? If yes is there anyways we can modify the index ilm policy?

---

<div class="post-metadata">

**Author:** ![Thomas74](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Thomas74](https://discuss.elastic.co/u/Thomas74)\
**Post date:** [July 1, 2020, 2:30pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/10 "2020-07-01T14:30:54Z")

</div>

Ah yes, the updated policy will be taken in count for the newer indexes.

I founded a post which already explain how to do it :

> [@Unable to update ILM policy](https://discuss.elastic.co/t/unable-to-update-ilm-policy/199480):
>
> Hello, I have a hot-warm architecture cluster running in production containing 1000+ daily indices spanning 3 months. A single ILM policy moves indices from hot to warm after 4 days of creation, then to cold phase after 30 days and delete phase after 90 days. Currently all of these indices have this ILM policy applied directly via templates. Warm phase is configured to move an index from hot nodes to warm nodes. Problem here is that warm nodes are running out of disk space where as hot nodes …

---

<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 29, 2020, 2:30pm UTC](https://discuss.elastic.co/t/index-lifecycle-create-index-every-day/239471/11 "2020-07-29T14:30:57Z")

</div>

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