Search code examples
jsonelasticsearchlogstashfilebeatgrok

what is the reason for this logstash error : exception=>#< "LogStash" ::Json::ParserError: Unexpected end-of-input in VALUE_STRING


I have the following log line

{"code":200,"message":"ok","responseBody":{"token":"asdadqwrqwkjrqwejr"},"time":"4545425244"}

and using logstash json plugin to parse this log but logstash show following error in logstash-plain.log :

exception=>#< "LogStash" ::Json::ParserError: Unexpected end-of-input in VALUE_STRING

what is the problem ? thanx


Solution

  • The exception

    Unexpected end-of-input in VALUE_STRING
    

    is thrown when the the parser reaches the end of the text to be parsed whilst trying to read a value. For example, the following will produce that error because it is missing a closing double quote.

    input { generator { count => 1 lines => [ '{"message":"ok}' ] } }
    filter {  json { source => "message" remove_field => [ "message" ] } }
    output { stdout { codec => rubydebug { metadata => false } } }
    

    If it runs out of text whilst reading the name of a field the exception will be Unexpected end-of-input in field name (that would happen for {"message}).