# Filebeat read different log paths and write to different elastic index with their own ilm policy,How?

**URL:** <https://discuss.elastic.co/t/filebeat-read-different-log-paths-and-write-to-different-elastic-index-with-their-own-ilm-policy-how/327638>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [March 14, 2023, 9:10am UTC](https://discuss.elastic.co/t/filebeat-read-different-log-paths-and-write-to-different-elastic-index-with-their-own-ilm-policy-how/327638 "2023-03-14T09:10:21Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 17, 2023, 11:56am UTC](https://discuss.elastic.co/t/filebeat-read-different-log-paths-and-write-to-different-elastic-index-with-their-own-ilm-policy-how/327638/6 "2023-03-17T11:56:11Z")

</div>

> [@PRASHANT\_MEHTA](#):
>
> Exiting: setup.template.name and setup.template.pattern have to be set if index name is modified

Probably because of this [same problem](https://discuss.elastic.co/t/filebeat-index-issue-template-pattern-name/133738/2).

The `setup.*` configuration needs to be in the root of the configuration, not under the `output.elasticsearch`.

Also, if you already have the template in Elasticsearch you do not even need these configurations, you just need to have a template that matches your index in elasticsearch and you can remove the `setup.template.*` and `setup.ilm.*`.

Since you have two different indices and want to use different templates you cannot use those `setup.template.*` and `setup.ilm.*` configurations in filebeat, you need to manage everything in the template on elasticsearch.

---

_[View the full topic](https://discuss.elastic.co/t/filebeat-read-different-log-paths-and-write-to-different-elastic-index-with-their-own-ilm-policy-how/327638)._
