# Response data from text file multiple folder to multiple index

**URL:** https://discuss.elastic.co/t/response-data-from-text-file-multiple-folder-to-multiple-index/236694
**Category:** Logstash
**Created:** [June 11, 2020, 11:51am UTC](https://discuss.elastic.co/t/response-data-from-text-file-multiple-folder-to-multiple-index/236694 "2020-06-11T11:51:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Puneeth\_S\_B\_Gowda1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/puneeth_s_b_gowda1/32/68544_2.png) [@Puneeth\_S\_B\_Gowda1](https://discuss.elastic.co/u/Puneeth_S_B_Gowda1)
#### Post date: [June 11, 2020, 11:51am UTC](https://discuss.elastic.co/t/response-data-from-text-file-multiple-folder-to-multiple-index/236694/1 "2020-06-11T11:51:30Z")

</div>

My logstash configuration is this

input { beats { port =\> 5044 } } filter { xml { store\_xml =\> "false" source =\> "message"  
xpath =\>["/propertyAvailability/hotelRates/hotel[2]/bookingChannel[4]/ratePlan[3]/miscInfo/text()","hhBedType"] } }  
output { elasticsearch { hosts =\> ["[http://localhost:9200](http://localhost:9200)"] index =\> "data1" } }  
My filebeat configuration is this

filebeat.inputs:

- type: log  
enabled: true  
paths: - D:\HotelHub\_ELK\Data1\*.txt (edited)

Now data is in data1 folder and moving to data1 index  
What we need is we will store data in 4 folder 1)data1 2)data2 3)data3 4)data4 all four folder data should move to four different index

---

<div class="post-metadata">

### Author: ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)
#### Post date: [June 11, 2020, 12:35pm UTC](https://discuss.elastic.co/t/response-data-from-text-file-multiple-folder-to-multiple-index/236694/2 "2020-06-11T12:35:24Z")

</div>

AFAIK events from filebeat should have a `source` field with the original path. So you could use a [grok](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html) pattern to extract the folder name from that, save this information in` [@metadata][logfolder]` and then set the index setting in the ES output to `%{[@metadata][logfolder]}`. Then you could just set the path for filebeat to `D:\HotelHub_ELK\Data*.txt` to read all folders starting with Data.

Another option would be to have one filebeat input for every folder and [add different fields](https://www.elastic.co/guide/en/beats/filebeat/current/add-fields.html) to them.

---

<div class="post-metadata">

### Author: ![Puneeth\_S\_B\_Gowda1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/puneeth_s_b_gowda1/32/68544_2.png) [@Puneeth\_S\_B\_Gowda1](https://discuss.elastic.co/u/Puneeth_S_B_Gowda1)
#### Post date: [June 17, 2020, 10:33am UTC](https://discuss.elastic.co/t/response-data-from-text-file-multiple-folder-to-multiple-index/236694/4 "2020-06-17T10:33:42Z")

</div>

filebeat.inputs:

- type: log

filebeat.config.modules:

path: ${path.config}/modules.d/\*.yml

reload.enabled: false

setup.template.settings:  
index.number\_of\_shards: 1

setup.kibana:

host: "192.168.100.136:5601"

output.logstash:

hosts: ["192.168.100.136:5044"]

processors:

- add\_host\_metadata: ~
- add\_cloud\_metadata: ~
- add\_docker\_metadata: ~
- add\_kubernetes\_metadata: ~

---

<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 15, 2020, 10:33am UTC](https://discuss.elastic.co/t/response-data-from-text-file-multiple-folder-to-multiple-index/236694/5 "2020-07-15T10:33:44Z")

</div>

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