# Output json

**URL:** https://discuss.elastic.co/t/output-json/86278
**Category:** Logstash
**Created:** [May 18, 2017, 2:24pm UTC](https://discuss.elastic.co/t/output-json/86278 "2017-05-18T14:24:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shaharz](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@shaharz](https://discuss.elastic.co/u/shaharz)
#### Post date: [May 18, 2017, 2:24pm UTC](https://discuss.elastic.co/t/output-json/86278/1 "2017-05-18T14:24:32Z")

</div>

hi,

Im running logstash to collect json log file. the log file contains lines of logs in json format. here is my configuration

input {  
file {  
codec =\> "json"  
path =\> "C:\Logs\Client.txt"  
path =\> "C:\Logs\Server.txt"  
}  
}  
filter  
{

}  
output {  
stdout { codec =\> rubydebug }  
elasticsearch {  
codec =\> "json"  
hosts =\> ["localhost:9200"]  
}  
}

now the thing is that to the debug window outputs the json correctly, means it breaks the json to fields as expected. but into the elastic it does not, it stays on the 'message' field as the all json log line

![](https://us1.discourse-cdn.com/elastic/original/3X/c/7/c72422dfdcfa68a96aba16b9d7cd4a23dcd42411.png)

any idea?

thanks !

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [May 22, 2017, 5:22am UTC](https://discuss.elastic.co/t/output-json/86278/2 "2017-05-22T05:22:40Z")

</div>

For starters, remove `codec => "json"` from your elasticsearch output configuration and let's see if that helps.

---

<div class="post-metadata">

### Author: ![shaharz](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@shaharz](https://discuss.elastic.co/u/shaharz)
#### Post date: [May 23, 2017, 10:53am UTC](https://discuss.elastic.co/t/output-json/86278/3 "2017-05-23T10:53:43Z")

</div>

Thanks 🙂 it works, this was the thing

---

<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: [June 20, 2017, 10:53am UTC](https://discuss.elastic.co/t/output-json/86278/4 "2017-06-20T10:53:59Z")

</div>

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