# How to enable ILM when I i have custom index name with hostname via logstash

**URL:** <https://discuss.elastic.co/t/how-to-enable-ilm-when-i-i-have-custom-index-name-with-hostname-via-logstash/189171>\
**Category:** Logstash\
**Created:** [July 5, 2019, 9:38pm UTC](https://discuss.elastic.co/t/how-to-enable-ilm-when-i-i-have-custom-index-name-with-hostname-via-logstash/189171 "2019-07-05T21:38:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thanura\_Kannangara](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Thanura\_Kannangara](https://discuss.elastic.co/u/Thanura_Kannangara)\
**Post date:** [July 5, 2019, 9:38pm UTC](https://discuss.elastic.co/t/how-to-enable-ilm-when-i-i-have-custom-index-name-with-hostname-via-logstash/189171/1 "2019-07-05T21:38:11Z")

</div>

I'm sending data from filebeat to elasticsearch via Logstash  
I managed to send data to ES with my custom index name even with this.

```
index => "%{[@metadata][beat]}-%{[host][hostname]}-%{[@metadata][version]}-%

```

But I'm having trouble with the ILM config. Below is the output config that I have in my logstash

```
output {
    elasticsearch {
        hosts => localhost
        manage_template => false
        index => "filebeat-%{[host][hostname]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
        #index => "%{[@metadata][beat]}-%{[host][hostname]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
        ilm_enabled => true
        ilm_rollover_alias => "filebeat-"
        ilm_pattern => "000001"
        ilm_policy => "filebeat-policy"
    }
}

```

As you can see above, after adding all the ilm\_\* configs, logstash doesnot even start.  
I know i might be lost here,

Basically what i want to do is, create daily indexes

```
filbeat-hostname-beatVersion-date

```

And associate them with a default ILM policy.

Please shed some light on this.

---

<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:** [August 2, 2019, 9:38pm UTC](https://discuss.elastic.co/t/how-to-enable-ilm-when-i-i-have-custom-index-name-with-hostname-via-logstash/189171/2 "2019-08-02T21:38:14Z")

</div>

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