# Failed to Import JSON data to elastic via logstash

**URL:** https://discuss.elastic.co/t/failed-to-import-json-data-to-elastic-via-logstash/72269
**Category:** Logstash
**Created:** [January 20, 2017, 7:28am UTC](https://discuss.elastic.co/t/failed-to-import-json-data-to-elastic-via-logstash/72269 "2017-01-20T07:28:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gutasaputra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gutasaputra/32/10472_2.png) [@gutasaputra](https://discuss.elastic.co/u/gutasaputra)
#### Post date: [January 20, 2017, 7:28am UTC](https://discuss.elastic.co/t/failed-to-import-json-data-to-elastic-via-logstash/72269/1 "2017-01-20T07:28:57Z")

</div>

hi, i tried to import json data to my elastic via logstash.  
this is my config :

config\_online.conf

> input  
> {  
> file  
> {  
> path =\> ["/usr/local/Cellar/logstash/5.1.1/config\_oneline.json"]  
> start\_position =\> "beginning"  
> }  
> }

> filter  
> {  
> mutate  
> {  
> replace =\> ["message", "%{message}"]  
> gsub =\> ['message','\n','']  
> }  
> if [message] =~ /^{.\*}$/  
> {  
> json { source =\> message }  
> }

> }

> output  
> {  
> elasticsearch {  
> protocol =\> "http"  
> codec =\> json  
> host =\> "localhost"  
> index =\> "json"  
> embedded =\> true  
> }  
> stdout { codec =\> rubydebug }  
> }

but when i try to running this with :

> logstash -f config\_oneline.conf

i got this error msg :

> [2017-01-20T14:21:54,282][ERROR][logstash.agent] fetched an invalid config {:config=\>"input \n{\n file \n {\n path =\> ["/usr/local/Cellar/logstash/5.1.1/config\_oneline.json"]\n start\_position =\> "beginning"\n }\n}\n\nfilter \n{\n mutate\n {\n replace =\> ["message", "%{message}"]\n gsub =\> ['message','\n','']\n }\n if [message] =~ /^{.\*}$/\n {\n json { source =\> message }\n }\n\n}\n\noutput\n{ \n elasticsearch {\n protocol =\> "http"\n codec =\> json\n host =\> "localhost"\n index =\> "json"\n embedded =\> true\n }\n\n stdout { codec =\> rubydebug }\n}\n\n", :reason=\>"Something is wrong with your configuration."}

how can i solve this issue?  
pls help me

thank you

---

<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: [January 20, 2017, 8:10am UTC](https://discuss.elastic.co/t/failed-to-import-json-data-to-elastic-via-logstash/72269/2 "2017-01-20T08:10:26Z")

</div>

You're using a number of old options in your elasticsearch output. Please consult the documentation for your version of Logstash to see what options are available.

---

<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 17, 2017, 8:10am UTC](https://discuss.elastic.co/t/failed-to-import-json-data-to-elastic-via-logstash/72269/3 "2017-02-17T08:10:29Z")

</div>

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