# Hability to create daily index to metricbeat

**URL:** <https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302>\
**Category:** Beats\
**Tags:** ilm-index-lifecycle-management, metricbeat\
**Created:** [March 10, 2022, 8:00am UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302 "2022-03-10T08:00:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [March 10, 2022, 8:00am UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302/1 "2022-03-10T08:00:28Z")

</div>

Hi all,  
We are deploying an stack monitoring to eck:

> <https://github.com/elastic/cloud-on-k8s/blob/2.0/config/recipes/beats/stack_monitoring.yaml>

Current monitoring are working fine, to Elasticsearch and kibana resources. But we have a problem with the index creation: metricbeat create a single index with format:

metricbeat-7.16.2-2022.03.09-000001

We want to change this to create a day index with the information about this day, somehting like metricbeat-7.16.2-stack-2022.03.09, metricbeat-7.16.2-stack-2022.03.10, ... to manage it with ILM polycies.

There're some way to change this configuration in this yml file conf to modify the index name creation?

Regards,

---

<div class="post-metadata">

**Author:** ![Tetiana\_Kravchenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tetiana_kravchenko/32/102683_2.png) [@Tetiana\_Kravchenko](https://discuss.elastic.co/u/Tetiana_Kravchenko)\
**Post date:** [March 14, 2022, 6:42pm UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302/2 "2022-03-14T18:42:16Z")

</div>

Hi @gerardgorrion !

did you try to change `output.elasticsearch.index` as described [here](https://www.elastic.co/guide/en/beats/metricbeat/current/change-index-name.html)? I think it should be possible to add mentioned configuration parameters under `spec.config`.

maybe it is also possible to define `setup.ilm.* ` [configuration](https://www.elastic.co/guide/en/beats/metricbeat/current/ilm.html#setup-ilm-option) in `spec.config` instead?

---

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [March 15, 2022, 7:52am UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302/3 "2022-03-15T07:52:52Z")

</div>

Hi @Tetiana_Kravchenko , we try to deploy with configmap with metricbeat.yml config and no work, the metricbeat no report any information when we use this config:

```auto
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: metricbeat-config
  namespace: default
  labels:
    k8s-app: metricbeat
data:
  metricbeat.yml: |-
    metricbeat.config.modules:
      # Mounted `metricbeat-daemonset-modules` configmap:
      path: ${path.config}/modules.d/*.yml
      # Reload module configs as they change:
      reload.enabled: false

    processors:
      - add_cloud_metadata: ~
      - add_docker_metadata: ~

    setup.template.name: "metricbeat"
    setup.template.pattern: "metricbeat-*"
    setup.ilm.enabled: false

    output.elasticsearch:
      hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
      username: '${ELASTICSEARCH_USERNAME:}'
      password: '${ELASTICSEARCH_PASSWORD:}'
      index: "metricbeat-%{[agent.version]}-monitoring-%{+yyyy.MM.dd}"

```

And mapping into beat deploy:

```auto
          volumeMounts:
            - name: config
              mountPath: /usr/share/metricbeat/metricbeat.yml
              readOnly: true
              subPath: metricbeat.yml
        volumes:
        - name: config
          configMap:
            name: metricbeat-config

```

but is no possible to change this file. Also, we try to deploy the metricbeat.yml file into /etc folder and use this arguments to use it:

```auto
        args: [
          "-c", "/etc/metricbeat.yml",
          "-e",
        ]

```

But metricbeat dowsn't work with this config. some idea?

Thanks!

---

<div class="post-metadata">

**Author:** ![Tetiana\_Kravchenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tetiana_kravchenko/32/102683_2.png) [@Tetiana\_Kravchenko](https://discuss.elastic.co/u/Tetiana_Kravchenko)\
**Post date:** [March 15, 2022, 8:36am UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302/4 "2022-03-15T08:36:45Z")

</div>

From the [`Beat` CRD](https://github.com/elastic/cloud-on-k8s/blob/2.0/config/crds/v1/all-crds.yaml#L1985-L2344) it doesn't seem that you should create your configMap and mount it explicitly:

1. you should define configuration either under [`spec.config`](https://github.com/elastic/cloud-on-k8s/blob/2.0/config/crds/v1/all-crds.yaml#L2048-L2051)
2. or under [`spec.configRef`](https://github.com/elastic/cloud-on-k8s/blob/2.0/config/crds/v1/all-crds.yaml#L2053-L2062) - but it is for Secret k8s resource:

```auto
ConfigRef contains a reference to an existing Kubernetes Secret

```

---

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [March 15, 2022, 9:31am UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302/5 "2022-03-15T09:31:01Z")

</div>

Thanks! we configure this lines into beat config and work fine now!

```auto
    setup.template.name: "metricbeat"
    setup.template.pattern: "metricbeat-*"
    setup.ilm.enabled: false
    output:
      elasticsearch:
        index: "metricbeat-%{[agent.version]}-monitoring-%{+yyyy.MM.dd}"

```

Now, we only need to monitoring logstash agents, apm-server and resolve the [incident](https://discuss.elastic.co/t/metricbeat-kibana-no-stable/299091) with kibana, and we wil finish the migration to metricbeat monitoring.

---

<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:** [April 12, 2022, 11:31am UTC](https://discuss.elastic.co/t/hability-to-create-daily-index-to-metricbeat/299302/6 "2022-04-12T11:31:02Z")

</div>

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