# Why I am getting one huge metricbeat index instead of daily indices?

**URL:** https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789
**Category:** Beats
**Tags:** metricbeat
**Created:** [October 21, 2020, 7:38am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789 "2020-10-21T07:38:06Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [October 21, 2020, 7:38am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/1 "2020-10-21T07:38:06Z")

</div>

Hi,

I am using elastic stack 7.9.2. I have set up metricbeat and it is exporting to elasticsearch. I haven't modified the index name setting in `metricbeat.yml` and is taking the default setting `index: "metricbeat-%{[agent.version]}-%{+yyyy.MM.dd}"`.

What I expected was metricbeat index getting created daily, like `metricbeat-7.9.2-2020.10.1` , `metricbeat-7.9.2-2020.10.2` , `metricbeat-7.9.2-2020.10.3` etc. Also, I was thinking about creating some ILM policy, so that indices older than 5 days will get automatically deleted.

Now, when I take a look at the indices, I can see one huge index `metricbeat-7.9.2-2020.10.14-000001` (started metricbeat on 14th). Why its happening like this and how can I fix this, to achieve what I am looking for?

Thanks.

---

<div class="post-metadata">

### Author: ![borna\_talebi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borna_talebi/32/76317_2.png) [@borna\_talebi](https://discuss.elastic.co/u/borna_talebi)
#### Post date: [October 21, 2020, 8:00am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/2 "2020-10-21T08:00:06Z")

</div>

Hi,  
In your `metricbeat.yml` file did you disabled ILM using `setup.ilm.enabled: false`?  
Because if you didn't, metricbeat will ignore` index: "metricbeat-%{[agent.version]}-%{+yyyy.MM.dd}"` and use indices with numbers at the end to manage the lifecycle.

according to docs:

> When [index lifecycle management (ILM)](https://www.elastic.co/guide/en/beats/filebeat/current/ilm.html) is enabled, the default `index` is `"filebeat-%{[agent.version]}-%{+yyyy.MM.dd}-%{index_num}"` , for example, `"filebeat-7.9.2-2020-10-21-000001"` . Custom `index` settings are ignored when ILM is enabled.

---

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [October 21, 2020, 8:09am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/3 "2020-10-21T08:09:10Z")

</div>

Hi @borna_talebi , below is my ILM config

```
# index name.
#setup.ilm.enabled: auto
#setup.ilm.rollover_alias: 'metricbeat'
#setup.ilm.pattern: "{now/d}-000001"
#setup.ilm.policy_name: "mypolicy"
#setup.ilm.policy_file:
setup.ilm.check_exists: false
#setup.ilm.overwrite: false

```

I have just disabled `setup.ilm.check_exists` and everything else is default. Is there anything need to be modified?

---

<div class="post-metadata">

### Author: ![borna\_talebi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borna_talebi/32/76317_2.png) [@borna\_talebi](https://discuss.elastic.co/u/borna_talebi)
#### Post date: [October 21, 2020, 8:15am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/4 "2020-10-21T08:15:24Z")

</div>

> [@elasticheart](#):
>
> Is there anything need to be modified?

It depends. if you want to fix your huge index then don't change anything and just configure your ILM and it should fix it.  
But if you want to have daily indices then use `setup.ilm.enabled: false`

---

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [October 21, 2020, 8:50am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/5 "2020-10-21T08:50:54Z")

</div>

@borna_talebi I got it and thanks for your suggestion 👍

Can you advice me how to configure ILM, say if I just want 1 index `metricbeat`, but I don't want messages older than 5 days in it. What should I do to achieve this? I don't want to archive old indices, say I don't want `warm` and `cold`. I just want the messages older than 5 days to get deleted. Also, I would like to know at what time this policy apply on the indices, say, the message on 01-10-2020 get deleted at 12'o clock on 16-10-2020?

---

<div class="post-metadata">

### Author: ![borna\_talebi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borna_talebi/32/76317_2.png) [@borna\_talebi](https://discuss.elastic.co/u/borna_talebi)
#### Post date: [October 21, 2020, 9:26am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/6 "2020-10-21T09:26:08Z")

</div>

> [@elasticheart](#):
>
> but I don't want messages older than 5 days in it

I'm not sure if this is the best solution but here is my suggestion:

1. In hot phase, set rollover to 1 day so ilm would create daily indices.

2. In delete phase, set `Timing for delete phase` to `5 days from rollover`.

Just to be clear, ILM works with **indices** not **messages** (documents).

---

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [October 21, 2020, 9:39am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/7 "2020-10-21T09:39:48Z")

</div>

Ok. Lemme try out this and I will reply here 👍

---

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [November 6, 2020, 7:15am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/8 "2020-11-06T07:15:19Z")

</div>

I did whatever need to be, still no hope. Lemme explain;

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/1/f/1fd89694edbad638330cc9b03225089fa7f337b4.png)  
**I have these many indices** 👆

 ![2](https://us1.discourse-cdn.com/elastic/original/3X/7/c/7cb13378400172266a36dcf92934fac0d5fff95e.png)  
**And this is my metricbeat index I am concerned about** 👆

 ![3](https://us1.discourse-cdn.com/elastic/original/3X/6/a/6aff8adbd03b938aaa239d144294e8a1776ff04b.png) ![4](https://us1.discourse-cdn.com/elastic/original/3X/8/8/8888d92cdef933f5061f75596ac2d0b7c076cc01.png) ![5](https://us1.discourse-cdn.com/elastic/original/3X/7/4/74c3db61ec3095e0992f596d3d2e478809a1d8d0.png)  
**This is my ILM policy** 👆

 ![6](https://us1.discourse-cdn.com/elastic/original/3X/9/d/9d023dd94dfba3ad51a569875ab87662c5730622.png)  
**These are my templates** 👆

 ![7](https://us1.discourse-cdn.com/elastic/original/3X/2/8/28f2ace8082864bc96166bbc70a39afb02ffa1a2.png) ![8](https://us1.discourse-cdn.com/elastic/original/3X/7/4/742e0e660f928faca5f9da44e3885cff291281b3.png)  
**And this is the template explained** 👆

Below is my ILM policy explained.

```
PUT _ilm/policy/metricbeat
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "1d",
            "max_size": "1gb"
          },
          "set_priority": {
            "priority": null
          }
        }
      },
      "warm": {
        "actions": {
          "set_priority": {
            "priority": null
          }
        }
      },
      "delete": {
        "min_age": "2d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

```

As per the policy, the index should be max 1 GB size and 1 day old. This index was created yesterday and more than 1 GB size (pri 1.1GB, total 2.1GB). How to fix this?

---

<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: [December 4, 2020, 9:15am UTC](https://discuss.elastic.co/t/why-i-am-getting-one-huge-metricbeat-index-instead-of-daily-indices/252789/9 "2020-12-04T09:15:27Z")

</div>

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