Metricbeat - how to create two different index templates from me metricbeat.yml

Hello guys,

I want to create two different index templates with different ILM policies for each module that I use in metricbeat.

My metricbeat.yml

metricbeat:
  modules:
  - hosts:
    - http://localhost:5067
    metricsets:
    - stats
    - state
    module: beat
    period: 10s
    setup.template.enabled: true
    setup.template.name: template_metricbeat-ov2-staging-microservices-beat
    setup.template.pattern: metricbeat-ov2-staging-microservices-beat-*
    setup.template.settings:
      index.lifecycle.name: data_retention_7_days
      index.lifecycle.rollover_alias: metricbeat-ov2-staging-microservices-beat
  - cpu_ticks: false
    metricsets:
    - cpu
    - filesystem
    - network
    - process
    module: system
    period: 10s
    processes:
    - .*
    setup.template.enabled: true
    setup.template.name: template_metricbeat-ov2-staging-microservices-system
    setup.template.pattern: metricbeat-ov2-staging-microservices-system-*
    setup.template.settings:
      index.lifecycle.name: data_retention_30_days
      index.lifecycle.rollover_alias: metricbeat-ov2-staging-microservices-system


###############################################################################
############################# Libbeat Config ##################################
# Base config file used by all other beats for using libbeat features

############################# Output ##########################################

output:
  elasticsearch:
    hosts:
    - ''
    indices:
    - index: metricbeat-ov2-staging-microservices-beat-%{[agent.version]}-%{+yyyy.MM.dd}
      when.contains:
        event.module: beat
    - index: metricbeat-ov2-staging-microservices-system-%{[agent.version]}-%{+yyyy.MM.dd}
      when.contains:
        event.module: system


############################# Logging #########################################

logging:
  files:
    rotateeverybytes: 104857600

The issue that I have is that none of the defined index templates gets created. I am not entirely sure if I am allowed to do under the modules.

    setup.template.enabled: true
    setup.template.name: template_metricbeat-ov2-staging-microservices-beat
    setup.template.pattern: metricbeat-ov2-staging-microservices-beat-*
    setup.template.settings:
      index.lifecycle.name: data_retention_7_days
      index.lifecycle.rollover_alias: metricbeat-ov2-staging-microservices-beat

At the moment both index templates are ignored and metricbeat creates the metricbeat-8.8.2 index template.

Ultimately, my question is how can one create two different index templates from the metricbeat.yml as I want different lifecycle policies attached to each template.

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