# How to Create Different index for different Logpaths

**URL:** <https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438>\
**Category:** Logstash\
**Created:** [April 10, 2020, 5:11am UTC](https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438 "2020-04-10T05:11:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pacha\_Gopi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pacha_gopi/32/45627_2.png) [@Pacha\_Gopi](https://discuss.elastic.co/u/Pacha_Gopi)\
**Post date:** [April 10, 2020, 5:11am UTC](https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438/1 "2020-04-10T05:11:08Z")

</div>

Hi I am getting logs from filebeat to my ELK server.One filebeat is sending two diiferent log files.My file beat is sending Nginx logs and Laraverl logs,my requirement is that i have to create Different index for different Logpaths can any one tell me how can I create different index

---

<div class="post-metadata">

**Author:** ![Pacha\_Gopi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pacha_gopi/32/45627_2.png) [@Pacha\_Gopi](https://discuss.elastic.co/u/Pacha_Gopi)\
**Post date:** [April 10, 2020, 11:53am UTC](https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438/2 "2020-04-10T11:53:27Z")

</div>

Can anyone help me out ??

---

<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:** [April 10, 2020, 1:50pm UTC](https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438/3 "2020-04-10T13:50:46Z")

</div>

Use a [conditional](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#conditionals) to test the value of [log][file][path] and set [@metadata][indexName] based on that value. Then pass

```
index => "%{[@metadata][indexName]}"

```

to the elasticsearch output.

---

<div class="post-metadata">

**Author:** ![Pacha\_Gopi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pacha_gopi/32/45627_2.png) [@Pacha\_Gopi](https://discuss.elastic.co/u/Pacha_Gopi)\
**Post date:** [April 10, 2020, 3:58pm UTC](https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438/4 "2020-04-10T15:58:44Z")

</div>

Hey thanks for reply ... and i will try 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:** [May 8, 2020, 3:58pm UTC](https://discuss.elastic.co/t/how-to-create-different-index-for-different-logpaths/227438/5 "2020-05-08T15:58:52Z")

</div>

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