# Logstash best practices for multiple sources

**URL:** https://discuss.elastic.co/t/logstash-best-practices-for-multiple-sources/303722
**Category:** Logstash
**Created:** [May 2, 2022, 8:43am UTC](https://discuss.elastic.co/t/logstash-best-practices-for-multiple-sources/303722 "2022-05-02T08:43:50Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 2, 2022, 4:27pm UTC](https://discuss.elastic.co/t/logstash-best-practices-for-multiple-sources/303722/2 "2022-05-02T16:27:21Z")

</div>

Use conditionals in the filter section to set the index name and then use a sprintf reference in the Elasticsearch output. There is an example [here](https://discuss.elastic.co/t/how-to-create-multiple-indexs-with-multiple-input-in-logstash/264416/4). Note that the index option is ignored if ILM is enabled, which is on by default in recent versions.

---

_[View the full topic](https://discuss.elastic.co/t/logstash-best-practices-for-multiple-sources/303722)._
