# Does ILM work in Logstash with custom index names?

**URL:** <https://discuss.elastic.co/t/does-ilm-work-in-logstash-with-custom-index-names/235816>\
**Category:** Logstash\
**Created:** [June 4, 2020, 4:50pm UTC](https://discuss.elastic.co/t/does-ilm-work-in-logstash-with-custom-index-names/235816 "2020-06-04T16:50:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgreszcz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sgreszcz/32/46322_2.png) [@sgreszcz](https://discuss.elastic.co/u/sgreszcz)\
**Post date:** [June 4, 2020, 4:50pm UTC](https://discuss.elastic.co/t/does-ilm-work-in-logstash-with-custom-index-names/235816/1 "2020-06-04T16:50:18Z")

</div>

Hi there, we are currently using a single, generic "logstash-\*" ElasticSearch output which works quite well with the default ILM defaults of 30 days or 50GB and the automatic alias naming convention of logstash-2020.04.03-000001, logstash-2020.04.13-000002, logstash-2020.04.24-000003, etc.

We are currently adding different data types via additional pipelines in a single logstash process but would like to keep those different data types for different amounts of time. I was thinking of creating multiple indexes with different names using a mutate like:

`mutate { add_field => { "[@metadata][target_index]" => "prod-%{+YYYY.MM.dd}" } }`

but then I saw the comment here: [https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#\_writing\_to\_different\_indices\_best\_practices](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#_writing_to_different_indices_best_practices)

You cannot use dynamic variable substitution when `ilm_enabled` is `true` and when using `ilm_rollover_alias` .

How can I enable custom logstash indices and have the associated ILM policies like: logstash-custom1-2020.04.24-000003?

---

<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:** [July 2, 2020, 4:50pm UTC](https://discuss.elastic.co/t/does-ilm-work-in-logstash-with-custom-index-names/235816/2 "2020-07-02T16:50:31Z")

</div>

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