I am getting "json_parse_exception"


(Anil Garapati) #1

$ curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/_bulk?pretty' --data-binary @satendra.log
{
"error" : {
"root_cause" : [
{
"type" : "json_parse_exception",
"reason" : "Illegal character ((CTRL-CHAR, code 27)): only regular white space (\r, \n, \t) is allowed between tokens\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@1ed16062; line: 1, column: 2]"
}
],
"type" : "json_parse_exception",
"reason" : "Illegal character ((CTRL-CHAR, code 27)): only regular white space (\r, \n, \t) is allowed between tokens\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@1ed16062; line: 1, column: 2]"
},
"status" : 500
}

can anyone tell me the reason and solution....please


(colaci) #2

Obviously you have a syntax error in your JSON. Show us the contents of satendra.log.


(colaci) #4

So why are you sending that log file to Elasticsearch? What is your intension?

P.S.
There are some (possibly) private IP adresses, hostnames and emails in that log, I recommend you to edit your post and remove/redact them.


(Anil Garapati) #5

Thank you Sir,

Actually I decided to remove once I get the solution but as per your suggestion I will remove it now.

I need to store all log files in ELASTIC SEARCH through logstash and then I need to see them in Kibana

as of now I dont have filebeat option. could you help to me


(colaci) #6

Make sure that the contents of the satendra.log is valid JSON. You can't just insert arbitrary contents. You have to format those contents in a key-value way using the JSON format. Please read the documentation.


(system) #7

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