# Logstash - multiple indices for one input file

**URL:** <https://discuss.elastic.co/t/logstash-multiple-indices-for-one-input-file/66927>\
**Category:** Logstash\
**Created:** [November 23, 2016, 2:02am UTC](https://discuss.elastic.co/t/logstash-multiple-indices-for-one-input-file/66927 "2016-11-23T02:02:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishna\_chaitanya](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krishna\_chaitanya](https://discuss.elastic.co/u/krishna_chaitanya)\
**Post date:** [November 23, 2016, 2:02am UTC](https://discuss.elastic.co/t/logstash-multiple-indices-for-one-input-file/66927/1 "2016-11-23T02:02:29Z")

</div>

I want to create multiple indices using Logstash configuration into ES. From my understanding, it is easy to use `type` in file-input if we have multiple inputs. Then, create one index per one `type`.

But, I do not have multiple input files here. I have only one input-file. I just want to parse results differently. That means, for one index, I want to apply lot of filters(date, **split** ,ruby..); for the other index, I do not want any filters applied. Finally put these indices into same elasticsearch output cluster.

How to achieve this?  
Below is config file which describes what I want to achieve.

```
input {
  file {
    codec => json
    path => "/path/to/json"
    start_position => "beginning"
  }
}

filter {
   #### **apply these filters only for index2**
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "index1" 
  }
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "index2" 
  }
  stdout { codec => rubydebug }
}
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 23, 2016, 2:24am UTC](https://discuss.elastic.co/t/logstash-multiple-indices-for-one-input-file/66927/2 "2016-11-23T02:24:21Z")

</div>

Use [https://www.elastic.co/guide/en/logstash/current/plugins-filters-clone.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-clone.html) and a bunch of conditionals 🙂

---

<div class="post-metadata">

**Author:** ![krishna\_chaitanya](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krishna\_chaitanya](https://discuss.elastic.co/u/krishna_chaitanya)\
**Post date:** [November 23, 2016, 1:31pm UTC](https://discuss.elastic.co/t/logstash-multiple-indices-for-one-input-file/66927/3 "2016-11-23T13:31:59Z")

</div>

Thanks for the idea. I think that is going to work. Let me try

---

<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:** [December 21, 2016, 1:32pm UTC](https://discuss.elastic.co/t/logstash-multiple-indices-for-one-input-file/66927/4 "2016-12-21T13:32:06Z")

</div>

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