# MULTIPLE FILES IN S3 as INPUT AND CREATE MULITPLE INDEXES IN S3

**URL:** https://discuss.elastic.co/t/multiple-files-in-s3-as-input-and-create-mulitple-indexes-in-s3/184795
**Category:** Logstash
**Created:** [June 7, 2019, 5:32pm UTC](https://discuss.elastic.co/t/multiple-files-in-s3-as-input-and-create-mulitple-indexes-in-s3/184795 "2019-06-07T17:32:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mohit\_Ruke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohit_ruke/32/46323_2.png) [@Mohit\_Ruke](https://discuss.elastic.co/u/Mohit_Ruke)
#### Post date: [June 7, 2019, 5:32pm UTC](https://discuss.elastic.co/t/multiple-files-in-s3-as-input-and-create-mulitple-indexes-in-s3/184795/1 "2019-06-07T17:32:28Z")

</div>

HI Everyone,

My requirement is I have an s3 bucket - it will have a hierarachy  
FOLDERNAME1  
--\> filename1  
FOLDERNAME2  
--\> Filename2  
and so on

So logstash should  
make the filename as an index in elasticsearch..  
This is my current configeration file, it works if I have just the filenames is s3 (direct) not under any folder. I the folder is important. Any idea how I could do this ?

input {  
s3 {  
bucket =\> "_"  
access\_key\_id =\> "_"  
secret\_access\_key =\> "\*"  
region =\> "us-east-1"  
codec =\> "json"  
}  
}

filter{  
mutate{  
add\_field =\>{  
"file" =\> "%{[@metadata][s3][key]}"  
}  
}  
}  
output {  
amazon\_es {  
hosts =\> \*  
region =\> "us-east-1"  
aws\_access\_key\_id =\> '_'  
aws\_secret\_access\_key =\> '_'  
index =\> "%{file}"  
template\_name =\> "sqe\_template"  
template\_overwrite =\> "true"  
codec =\> "json"  
}

If I have a filename sqe-2019-01-01 index is 2019-01-01

how do I get this once I have the files inside their respective folder

Thank You,  
Mohit Ruke

---

<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 5, 2019, 5:32pm UTC](https://discuss.elastic.co/t/multiple-files-in-s3-as-input-and-create-mulitple-indexes-in-s3/184795/2 "2019-07-05T17:32:28Z")

</div>

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