# Multiple ilm and template for multiple index in filebeat directly to elasticsearch

**URL:** https://discuss.elastic.co/t/multiple-ilm-and-template-for-multiple-index-in-filebeat-directly-to-elasticsearch/311716
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [August 9, 2022, 11:17am UTC](https://discuss.elastic.co/t/multiple-ilm-and-template-for-multiple-index-in-filebeat-directly-to-elasticsearch/311716 "2022-08-09T11:17:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Zahraa\_Dehghan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zahraa_dehghan/32/78634_2.png) [@Zahraa\_Dehghan](https://discuss.elastic.co/u/Zahraa_Dehghan)
#### Post date: [August 9, 2022, 11:17am UTC](https://discuss.elastic.co/t/multiple-ilm-and-template-for-multiple-index-in-filebeat-directly-to-elasticsearch/311716/1 "2022-08-09T11:17:33Z")

</div>

Hi ,  
I am gathering log from multiple containers and I want to send them to multiple index with multiple ilm and template , here is my config:

```auto
      filebeat.autodiscover:
        providers:
          - type: kubernetes
            hints.enabled: true
            templates:
              - condition:
                - equals:
                    kubernetes.container.name: "nginx"
                config:
                  - module: nginx
                    access:
                      enabled: true
                      input:
                        type: container
                        fields:
                          type: hypernova-nginx
                        paths:
                          - /var/log/containers/*-${data.kubernetes.container.id}.log     
              - condition:
                  equals:
                    kubernetes.container.name: "ingress-nginx-controller"
                config:
                  - module: nginx
                    ingress_controller:
                      enabled: true
                      input:
                        type: container
                        fields:
                          type: ingress 
                        paths:
                          - /var/log/containers/*-${data.kubernetes.container.id}.log
      processors:
        - add_kubernetes_metadata:
      output.elasticsearch:
        indices:
          - index: "ingress-template-%{+yyyy.MM.dd}-000001"
            when.equals:
              fields.type: "ingress"
            setup.template:
              name: "ingress-template"
              pattern: "ingress-*"
              type: index
            setup.ilm:
              enabled: true
              rollover_alias: "ingress-template"
              pattern: "{now/d}-000001"
              policy_name: "ingress-custom"
          - index: "hypernova-nginx-template-%{+yyyy.MM.dd}-000001"
            when.equals:
              fields.type: "hypernova-nginx"
            setup.template:
              name: "hypernova-nginx-template"
              pattern: "hypernova-nginx-*"
              type: index
            setup.ilm:
              enabled: true
              rollover_alias: "hypernova-nginx-template"
              pattern: "{now/d}-000001"
              policy_name: "hypernova-nginx-custom"

        hosts: ["X", "X"]
        bulk_max_size: 100

```

logs go to their own index but ilm and template look like not working and rollover doesnot work.  
any ideas?

---

<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: [September 6, 2022, 11:18am UTC](https://discuss.elastic.co/t/multiple-ilm-and-template-for-multiple-index-in-filebeat-directly-to-elasticsearch/311716/2 "2022-09-06T11:18:22Z")

</div>

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