LogStash::Json::ParserError: Unexpected end-of-input within/between Object entries for curly brace inside string

When String contains opening curly braces '{' logstash failed to parse that JSON. As per JSON doc, we don't need to escape curly brace. then how can I parse this type of JSON through logstash?

JSON file:

{
"DESCRIPTION":"TOP{SET-3}",
"QUANTITY":"1"
}

Logstash conf.

input{
    beats {
        port => "5044"
    }
}
filter {
		prune {
                               whitelist_names => ["^message$","^@timestamp$"]
		}
    json {
            source => "message"
            target => "target"
    }
.........
}
output{
...........
}

ERROR:

 :exception=>#<LogStash::Json::ParserError: Unexpected end-of-input within/between Object entries
:exception=>#<LogStash::Json::ParserError: Unexpected character (':' (code 58)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: (byte[])""DESCRIPTION":"TOP{SET-3}",
"QUANTITY":"1"}

Can anyone help here?

Thanks:)

A json filter will parse

{ "DESCRIPTION":"TOP{SET-3}", "QUANTITY":"1" }

exactly as one would expect. Given

"DESCRIPTION":"TOP{SET-3}", "QUANTITY":"1" }

it will produce exactly the error you show. I suspect the problem is that the regexp you are using in a multiline processor in filebeat is incorrectly matching the mid-line { and treating it as a new JSON object.

1 Like

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