# Cannot enable ilm with custom indices in my apm-server.yml

**URL:** <https://discuss.elastic.co/t/cannot-enable-ilm-with-custom-indices-in-my-apm-server-yml/232630>\
**Category:** APM\
**Tags:** server\
**Created:** [May 14, 2020, 11:53am UTC](https://discuss.elastic.co/t/cannot-enable-ilm-with-custom-indices-in-my-apm-server-yml/232630 "2020-05-14T11:53:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elk51211](https://avatars.discourse-cdn.com/v4/letter/e/ccd318/32.png) [@elk51211](https://discuss.elastic.co/u/elk51211)\
**Post date:** [May 14, 2020, 11:53am UTC](https://discuss.elastic.co/t/cannot-enable-ilm-with-custom-indices-in-my-apm-server-yml/232630/1 "2020-05-14T11:53:14Z")

</div>

**Kibana version** :  
7.6.0

**Elasticsearch version** :  
7.6.0

**APM Server version** :  
7.6.0

**APM Agent language and version** :  
1.15

**Fresh install or upgraded from other version?**  
Fresh install

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

Trying to setup custom indices with:

```auto
    setup:
      template:
        name: "apm-%{[observer.version]}"
        pattern: "*apm-*"
        enabled: true
        overwrite: true

    queue.mem.events: 4096
    max_procs: 4

    output.elasticsearch:
      hosts: ["http://elasticsearch:9200"]
      indices:
        - index: "customnamespace-apm-%{[observer.version]}-sourcemap"
          when.contains:
            processor.event: "sourcemap"
        - index: "customnamespace-apm-%{[observer.version]}-error-%{+yyyy.MM.dd}"
          when.contains:
            processor.event: "error"
        - index: "customnamespace-apm-%{[observer.version]}-transaction-%{+yyyy.MM.dd}"
          when.contains:
            processor.event: "transaction"
        - index: "customnamespace-apm-%{[observer.version]}-span-%{+yyyy.MM.dd}"
          when.contains:
            processor.event: "span"
        - index: "customnamespace-apm-%{[observer.version]}-metric-%{+yyyy.MM.dd}"
          when.contains:
            processor.event: "metric"
        - index: "customnamespace-apm-%{[observer.version]}-onboarding-%{+yyyy.MM.dd}"
          when.contains:
            processor.event: "onboarding"

```

Whenever i enable ilm, i either don't see my custom indices anymore or i don't see an ilm policy, depending on whether i set ilm.enabled: "auto" or ilm.enabled: "true".

How can I attach my own ilm policies to my custom indices without either of them disappearing or not being displayed at all?

This is what my ilm looks like:

```auto
    apm-server:
      host: "0.0.0.0:8200"
      concurrent_requests: 5
      ilm:
        enabled: "auto"
        setup:
          mapping:
            - event_type: "error"
              policy_name: "customnamespace-apm-error-span-policy"
            - event_type: "span"
              policy_name: "customnamespace-apm-error-span-policy"
            - event_type: "transaction"
              policy_name: "customnamespace-apm-transaction-metric-policy"
            - event_type: "metric"
              policy_name: "customnamespace-apm-transaction-metric-policy"
          enabled: true
          policies:
            - name: "customnamespace-apm-error-span-policy"
              policy:
                phases:
                  hot:
                    actions:
                      rollover:
                        max_size: "50gb"
                        max_age: "1d"
                      set_priority:
                        priority: 100
                  warm:
                    min_age: "7d"
                    actions:
                      set_priority:
                        priority: 50
                      readonly: {}
                  cold:
                    min_age: "30d"
                    actions:
                      set_priority:
                        priority: 0
                      freeze: {}
                  delete:
                    min_age: "60d"
                    actions:
                      delete: {}
            - name: "customnamespace-apm-transaction-metric-policy"
              policy:
                phases:
                  hot:
                    actions:
                      rollover:
                        max_size: "50gb"
                        max_age: "30d"
                      set_priority:
                        priority: 100
                  warm:
                    min_age: "60d"
                    actions:
                      set_priority:
                        priority: 50
                      readonly: {}
                  cold:
                    min_age: "90d"
                    actions:
                      set_priority:
                        priority: 0
                      freeze: {}

```

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [May 14, 2020, 1:19pm UTC](https://discuss.elastic.co/t/cannot-enable-ilm-with-custom-indices-in-my-apm-server-yml/232630/2 "2020-05-14T13:19:16Z")

</div>

Configuring custom rollover aliases when using ILM is not currently supported. You can follow the [enhancement request issue](https://github.com/elastic/apm-server/issues/3779) for that.

---

<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:** [June 4, 2020, 9:19am UTC](https://discuss.elastic.co/t/cannot-enable-ilm-with-custom-indices-in-my-apm-server-yml/232630/3 "2020-06-04T09:19:41Z")

</div>

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