Add life cycle policy on metricbeat indices

I'm trying to add a life cycle policy to my indices through Kibana. I created an index template and a lifecycle policy but I get this error: setting [index.lifecycle.rollover_alias] for index [jobmetrics-preprod-2022.09.01] is empty or not defined
Why is that and why do I need to configure an alias for that?
This is the metricbeat.yml ({{}} - We replace depending on the environment).

logging.level: error
cloud.id: {{ elastic.cloud.id }}
cloud.auth: {{ elastic.cloud.auth }}
fields:
  class: {{ ec2InstanceClass }}
output.elasticsearch:
    allow_older_versions: true
    indices:
        - index: "jobmetrics-{{ hostenv }}-%{+yyyy.MM.dd}"
setup.template:
    name: "jobmetrics-{{ hostenv }}"
    pattern: "jobmetrics-{{ hostenv }}-*"
    enabled: true
    settings:
      index.number_of_shards: 1
setup.ilm.enabled: false

Does Troubleshooting index lifecycle management errors | Elasticsearch Guide [8.4] | Elastic help?

I think it's because I'm using the setup.template option. I think I can't use lifecycle management with it. I'm not sure.

perhaps take a look at, it is for filebeat but hold true for metricbeat as well.
In short if you have already created a template in elasticsearch set and want to set your own index name

setup.template.enabled: false

Maybe I just need to add "-%{index_num}" to my template? Because I now get error saying something like, I need numbers in the end of the name

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