# Auto-delete zipkin indices

**URL:** https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [September 4, 2020, 1:21pm UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545 "2020-09-04T13:21:11Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ajoshi83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajoshi83/32/75108_2.png) [@ajoshi83](https://discuss.elastic.co/u/ajoshi83)
#### Post date: [September 4, 2020, 1:21pm UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/1 "2020-09-04T13:21:12Z")

</div>

Hi.  
I am using Elastic Search 7.3.1 as a storage engine for OpenZipkin. Zipkin creates a span index daily in the format "zipkin-span-YYYY-MM-dd".

How I can automate the deletion of the Zipkin indices when its old than 10 days?

I gave a try to Elastic Search ILM with below PUT requests:

**PUT** [http://localhost:9200/\_ilm/policy/zipkin\_indices\_policy](http://localhost:9200/_ilm/policy/zipkin_indices_policy)

```auto
    {
        "policy": {"phases": {"hot": {"actions": { "rollover": {"max_age": "03m"}}},
                                            "delete": {"min_age": "02m","actions": {"delete": {}}}}
                       }
    }

```

**PUT** [http://localhost:9200/\_template/zipkinidx\_template](http://localhost:9200/_template/zipkinidx_template)

```auto
    {
       "index_patterns": ["zipkin*"],
       "settings": {"number_of_shards": 1, "number_of_replicas": 1,
                            "index.lifecycle.name": "zipkin_indices_policy"
                          }
    } 

```

but it fails at the action `rollover` with the below error:

```auto
    {"indices":{"zipkin-span-2020-09-04":{"index":"zipkin-span-2020-09-04","managed":true,"policy":"zipkin_indices_policy","lifecycle_date_millis":1599223883087,"phase":"hot","
   phase_time_millis":1599223884147,"action":"rollover","action_time_millis":1599223926386,"step":"ERROR","step_time_millis":1599224524930,"failed_step":"check-rollover-ready"
    ,"step_info":{"type":"illegal_argument_exception","reason":"setting [index.lifecycle.rollover_alias] for index [zipkin-span-2020-09-04] is empty or not defined","stack_trac
    e":"java.lang.IllegalArgumentException: setting [index.lifecycle.rollover_alias] for index [zipkin-span-2020-09-04] is empty or not defined\n\tat org.elasticsearch.xpack.co
    re.indexlifecycle.WaitForRolloverReadyStep.evaluateCondition(WaitForRolloverReadyStep.java:50)\n\tat org.elasticsearch.xpack.indexlifecycle.IndexLifecycleRunner.runPeriodic
    Step(IndexLifecycleRunner.java:133)\n\tat org.elasticsearch.xpack.indexlifecycle.IndexLifecycleService.triggerPolicies(IndexLifecycleService.java:270)\n\tat org.elasticsear
    ch.xpack.indexlifecycle.IndexLifecycleService.triggered(IndexLifecycleService.java:213)\n\tat org.elasticsearch.xpack.core.scheduler.SchedulerEngine.notifyListeners(Schedul
    erEngine.java:168)\n\tat org.elasticsearch.xpack.core.scheduler.SchedulerEngine$ActiveSchedule.run(SchedulerEngine.java:196)\n\tat java.base/java.util.concurrent.Executors$
    RunnableAdapter.call(Executors.java:515)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ScheduledThreadPoolEx
    ecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat j
    ava.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:835)\n"},"phase_execution":{"polic
    y":"zipkin_indices_policy","phase_definition":{"min_age":"0ms","actions":{"rollover":{"max_age":"3m"}}},"version":5,"modified_date_in_millis":1599223847778}}}}

```

- Is it a must for an index to have an alias?
- As the creation of the index is handled by the Zipkin and it does not create an alias for the index how can I proceed autodeletion of the index?

(I know one possible solution is to use Curator or hit DELETE API from a cron job but I am looking a solution from ilm perspective)

Thanks.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 7, 2020, 2:02am UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/2 "2020-09-07T02:02:27Z")

</div>

> [@ajoshi83](#):
>
> - Is it a must for an index to have an alias?

For ILM, yes.

> [@ajoshi83](#):
>
> As the creation of the index is handled by the Zipkin and it does not create an alias for the index how can I proceed autodeletion of the index?

Move from daily indices to letting ILM manage rollover for you.

---

<div class="post-metadata">

### Author: ![ajoshi83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajoshi83/32/75108_2.png) [@ajoshi83](https://discuss.elastic.co/u/ajoshi83)
#### Post date: [September 8, 2020, 10:30am UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/3 "2020-09-08T10:30:27Z")

</div>

Hi Mark. Thanks for the reply.

As adding an alias to the index is not in our control (index is created by Zipkin), I have to proceed with the curator at least for now.

Does ILM or the ILM's alias feature need any commercial license? If not, I will check with the openzipkin team if they can add alias to the indices.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 8, 2020, 12:42pm UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/4 "2020-09-08T12:42:20Z")

</div>

The feature that requires an alias within ILM is rollover. This should as far as I know not be mandatory so you should be possible to use ILM with the indices exactly as they are currently created by zip kin.

---

<div class="post-metadata">

### Author: ![lzukel](https://avatars.discourse-cdn.com/v4/letter/l/4491bb/32.png) [@lzukel](https://discuss.elastic.co/u/lzukel)
#### Post date: [September 8, 2020, 12:58pm UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/5 "2020-09-08T12:58:03Z")

</div>

Try taking out hot section of your ilm...

**PUT** [http://localhost:9200/\_ilm/policy/zipkin\_indices\_policy](http://localhost:9200/_ilm/policy/zipkin_indices_policy)

```
{"policy": {"phases": {"delete": {"min_age": "02m","actions": {"delete": {}}}}}}
```

---

<div class="post-metadata">

### Author: ![ajoshi83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajoshi83/32/75108_2.png) [@ajoshi83](https://discuss.elastic.co/u/ajoshi83)
#### Post date: [September 10, 2020, 8:55am UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/6 "2020-09-10T08:55:17Z")

</div>

Hi Izukel. Many thanks for the reply which turned to the solution.

Yes, removing the hot phase and keeping only the delete phase in the policy removed the index.

---

<div class="post-metadata">

### Author: ![ajoshi83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ajoshi83/32/75108_2.png) [@ajoshi83](https://discuss.elastic.co/u/ajoshi83)
#### Post date: [September 10, 2020, 9:00am UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/7 "2020-09-10T09:00:37Z")

</div>

Hi Christian. Thanks for the reply.

Ignoring the rollover phase from the policy and to consider only delete phase worked.

---

<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: [October 8, 2020, 9:00am UTC](https://discuss.elastic.co/t/auto-delete-zipkin-indices/247545/8 "2020-10-08T09:00:39Z")

</div>

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