# Logstash - Reference JSON files in a folder

**URL:** https://discuss.elastic.co/t/logstash-reference-json-files-in-a-folder/163573
**Category:** Logstash
**Created:** [January 9, 2019, 3:53pm UTC](https://discuss.elastic.co/t/logstash-reference-json-files-in-a-folder/163573 "2019-01-09T15:53:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mgutier](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mgutier](https://discuss.elastic.co/u/mgutier)
#### Post date: [January 9, 2019, 3:53pm UTC](https://discuss.elastic.co/t/logstash-reference-json-files-in-a-folder/163573/1 "2019-01-09T15:53:57Z")

</div>

Trying to get a configuration going in Logstash where I can reference multiple JSON files from a folder and have it process them accordingly -- not sure if this is at all the correct way to go about this, here is what I have so far

input {  
syslog {  
port =\> 514  
codec =\> "json"  
}  
}

filter {  
path =\> "/home/\*.json" ]  
}  
}

output {  
if [codec] == "json" {  
elasticsearch {  
hosts =\> "IP:9200"  
http\_compression =\> "true"  
index =\> "testjson-%{+YYYY.MM.dd}"  
}  
}

---

<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: [January 9, 2019, 4:59pm UTC](https://discuss.elastic.co/t/logstash-reference-json-files-in-a-folder/163573/2 "2019-01-09T16:59:35Z")

</div>

I would start off with this:

```
input {
    file {
        path => "/tmp/foo/*.json"
        sincedb_path => "/dev/null"
        mode => "read"
        codec => multiline { pattern => "^Spalanzani" negate => true what => "previous" auto_flush_interval => 2 }
        file_completed_action => "log"
        file_completed_log_path => "/dev/null"
    }
}
filter { json { source => "message" } }
output { stdout { codec => rubydebug } }

```

You need to read up on what those options on the [file input](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html) are doing.

---

<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: [February 6, 2019, 4:59pm UTC](https://discuss.elastic.co/t/logstash-reference-json-files-in-a-folder/163573/3 "2019-02-06T16:59:48Z")

</div>

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