# Metricbeat and Heartbeat 8.x custom index Name should pickup from template ,but creates always bedefault index name

**URL:** https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557
**Category:** Beats
**Tags:** metricbeat
**Created:** [July 4, 2023, 12:11pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557 "2023-07-04T12:11:41Z")
**Posts on this page:** 4
**Page:** 2

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [July 11, 2023, 1:59pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557/21 "2023-07-11T13:59:18Z")

</div>

> [@PRASHANT\_MEHTA](#):
>
> **As you mentioned you are using 8.8.0** ,here this is valid(cis-metric-%{[agent.version]}),same is not valid in 8.7.1 and I need to manually put index name only and now it works,weird:
> 
> **8.8.0:**
> 
> ```auto
> index: "cis-metric-%{[agent.version]}"(yml)
> 
> ```
> 
> I'm using 8.7.1 version and I need to do below,this is not good practice,any alterantive or what might be the reason in 8.7.1 this cis-metric-**%{[agent.version]}** dont work:  
> **8.7.1** using below then only data stream created.  
> `index: "cis-metric-8.7.1"`(yml)

8.7.1 Works exactly the same using the process above (manually installing ILM and Template) I just changed the version numbers from 8.8.0 to 8.7.1  
I am not sure what your issue is. I just tested it, works exactly the same you have a typo or mismatch somewhere

My 8.7.1

```auto
setup.ilm.enabled: false
setup.template.enabled: false
output.elasticsearch:
  hosts: ["http://localhost:9200"]
  index: "cis-metric-%{[agent.version]}"   

```

After running metricbeat 8.7.1

```auto
GET _data_stream/cis-metric-8.7.1

{
  "data_streams": [
    {
      "name": "cis-metric-8.7.1",
      "timestamp_field": {
        "name": "@timestamp"
      },
      "indices": [
        {
          "index_name": ".ds-cis-metric-8.7.1-2023.07.11-000001",
          "index_uuid": "6c6CMe6IStqPsnQ5EMN4qw"
        }
      ],
      "generation": 1,
      "status": "YELLOW",
      "template": "cis-metric-8.7.1",
      "ilm_policy": "cis-metric-policy",
      "hidden": false,
      "system": false,
      "allow_custom_routing": false,
      "replicated": false
    }
  ]
}

```

 ![Screenshot 2023-07-11 at 6.54.18 AM](https://us1.discourse-cdn.com/elastic/original/3X/1/5/15acee4fcb73b4de270cc42ae27f62d3dbb6ad49.png)

 ![Screenshot 2023-07-11 at 6.54.22 AM](https://us1.discourse-cdn.com/elastic/original/3X/e/d/ed121b81dfc89818f8bf306220f4bd6660f03fbb.png)

> [@PRASHANT\_MEHTA](#):
>
> Alternatively do u think it would be fine if i remove 8.7.1 from-index pattern,template and from yml and instead only use cis-metric only.

Sure we put the version number in to allow for changes between versions if needed.

You will just need to make sure you make the proper changes and take out the version number everywhere...

But the fact it is not working means you have something else going on... you should find it....

Just for reference here is the 8.7.1 code I gave you the metricbeat.yml section above

```auto
GET _data_stream/cis-metric-8.7.1

DELETE _data_stream/cis-metric-8.7.1

GET _ilm/policy/cis-metric-policy

DELETE _ilm/policy/cis-metric-policy

PUT _ilm/policy/cis-metric-policy
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "30d",
            "max_primary_shard_size": "50gb"
          }
        }
      }
    }
  }
}

DELETE _index_template/cis-metric-8.7.1

PUT _index_template/cis-metric-8.7.1
{
  "index_patterns": [
    "cis-metric-8.7.1"
  ],
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "cis-metric-policy"
        },
        "mapping": {
          "total_fields": {
            "limit": "10000"
          }
        },
        "number_of_shards": "1"
      }
    },
    "mappings": {
      "properties": {
        "system.cpu.iowait.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.process.memory.rss.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.diskio.write.bytes": {
          "type": "long"
        },
        "system.load.cores": {
          "type": "long"
        },
        "system.process.cpu.total.value": {
          "type": "long"
        },
        "service.type": {
          "type": "keyword"
        },
        "system.diskio.iostat.service_time": {
          "type": "float"
        },
        "system.memory.actual.free": {
          "type": "long"
        },
        "system.cpu.idle.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "agent.name": {
          "type": "keyword"
        },
        "system.memory.total": {
          "type": "long"
        },
        "system.diskio.write.time": {
          "type": "long"
        },
        "process.ppid": {
          "type": "long"
        },
        "system.diskio.iostat.write.await": {
          "type": "float"
        },
        "system.fsstat.total_size.free": {
          "type": "long"
        },
        "system.memory.free": {
          "type": "long"
        },
        "system.memory.swap.free": {
          "type": "long"
        },
        "system.memory.actual.used.pct": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "system.diskio.iostat.queue.avg_size": {
          "type": "float"
        },
        "agent.id": {
          "type": "keyword"
        },
        "system.memory.actual.used.bytes": {
          "type": "long"
        },
        "system.diskio.iostat.busy": {
          "type": "float"
        },
        "system.diskio.name": {
          "type": "keyword"
        },
        "system.cpu.user.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.memory.used.bytes": {
          "type": "long"
        },
        "system.network.name": {
          "type": "keyword"
        },
        "system.diskio.iostat.request.avg_size": {
          "type": "float"
        },
        "system.diskspace.usage": {
          "type": "long"
        },
        "system.cpu.system.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.diskio.iostat.read.request.merges_per_sec": {
          "type": "float"
        },
        "system.cpu.irq.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "process.type": {
          "type": "keyword"
        },
        "process.details": {
          "type": "keyword"
        },
        "system.cpu.user.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "user.name": {
          "type": "text",
          "fields": {
            "keyword": {
              "ignore_above": 256,
              "type": "keyword"
            }
          }
        },
        "system.network.in.bytes": {
          "type": "long"
        },
        "system.network.in.dropped": {
          "type": "long"
        },
        "system.diskio.io.ops": {
          "type": "long"
        },
        "mountpoint.details": {
          "type": "keyword"
        },
        "system.diskio.iostat.write.per_sec.bytes": {
          "type": "float"
        },
        "system.fsstat.count": {
          "type": "long"
        },
        "system.load.1": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "system.process.cpu.total.ticks": {
          "type": "long"
        },
        "system.cpu.softirq.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.cpu.nice.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.load.5": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "metricset.period": {
          "type": "long"
        },
        "system.diskio.iostat.read.per_sec.bytes": {
          "type": "float"
        },
        "system.process.memory.share": {
          "type": "long"
        },
        "process.pgid": {
          "type": "long"
        },
        "system.process.memory.rss.bytes": {
          "type": "long"
        },
        "@timestamp": {
          "type": "date"
        },
        "system.network.in.errors": {
          "type": "long"
        },
        "system.process.cpu.total.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.cpu.nice.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.memory.used.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.diskio.iostat.read.await": {
          "type": "float"
        },
        "system.cpu.irq.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "process.pid": {
          "type": "long"
        },
        "system.load.norm.15": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "system.diskio.read.count": {
          "type": "long"
        },
        "system.filesystem.used.pct": {
          "type": "float"
        },
        "system.cpu.iowait.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.process.memory.size": {
          "type": "long"
        },
        "system.network.out.dropped": {
          "type": "long"
        },
        "cpu.status": {
          "type": "keyword"
        },
        "host.name": {
          "type": "text",
          "fields": {
            "keyword": {
              "ignore_above": 256,
              "type": "keyword"
            }
          }
        },
        "system.diskio.iostat.await": {
          "type": "float"
        },
        "system.network.out.packets": {
          "type": "long"
        },
        "system.cpu.steal.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.cpu.steal.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.diskio.write.count": {
          "type": "long"
        },
        "process.name": {
          "type": "text",
          "fields": {
            "keyword": {
              "ignore_above": 256,
              "type": "keyword"
            }
          }
        },
        "system.diskio.read.time": {
          "type": "long"
        },
        "system.diskio.serial_number": {
          "type": "keyword"
        },
        "system.fsstat.total_files": {
          "type": "long"
        },
        "system.network.in.packets": {
          "type": "long"
        },
        "system.cpu.total.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.network.out.errors": {
          "type": "long"
        },
        "system.diskio.iostat.write.request.merges_per_sec": {
          "type": "float"
        },
        "system.memory.swap.total": {
          "type": "long"
        },
        "system.diskio.io.time": {
          "type": "long"
        },
        "system.cpu.total.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.load.15": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "system.cpu.cores": {
          "type": "long"
        },
        "system.fsstat.status": {
          "type": "keyword"
        },
        "system.cpu.softirq.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.load.norm.5": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "system.diskio.iostat.write.request.per_sec": {
          "type": "float"
        },
        "system.diskio.read.bytes": {
          "type": "long"
        },
        "system.fsstat.total_size.used": {
          "type": "long"
        },
        "system.load.norm.1": {
          "scaling_factor": 100,
          "type": "scaled_float"
        },
        "system.process.cpu.start_time": {
          "type": "date"
        },
        "system.memory.swap.used.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.cpu.idle.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.diskio.iostat.read.request.per_sec": {
          "type": "float"
        },
        "system.network.out.bytes": {
          "type": "long"
        },
        "system.memory.swap.used.bytes": {
          "type": "long"
        },
        "process.args": {
          "type": "keyword"
        },
        "system.cpu.system.norm.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "system.process.cpu.total.pct": {
          "scaling_factor": 1000,
          "type": "scaled_float"
        },
        "metricset.name": {
          "type": "keyword"
        },
        "system.fsstat.total_size.total": {
          "type": "long"
        },
        "system.process.state": {
          "type": "keyword"
        }
      }
    }
  },
  "composed_of": [],
  "data_stream": {
    "hidden": false,
    "allow_custom_routing": false
  }
}

```

---

<div class="post-metadata">

### Author: ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)
#### Post date: [July 11, 2023, 2:12pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557/22 "2023-07-11T14:12:31Z")

</div>

I've noticed in addition to datastream below is also getting created:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/7/177089eb15d95413d1f6d2e8b9533b1781c66d80.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/3/a34520f9dc2a484d97de4b44d1f300984a5db771.png)

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [July 11, 2023, 3:40pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557/23 "2023-07-11T15:40:37Z")

</div>

Yes that is called the Backing Index... you should read [about Data Streams](https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html)...

---

<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: [August 8, 2023, 5:41pm UTC](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557/24 "2023-08-08T17:41:13Z")

</div>

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

[Previous page](https://discuss.elastic.co/t/metricbeat-and-heartbeat-8-x-custom-index-name-should-pickup-from-template-but-creates-always-bedefault-index-name/337557.md?page=1)
