I have a valid JSON structure that is prepended with a fixed string and then a number. Something like:
RRR This is the leading string created at 01-01-2017 at 12:34:56:
{
valid JSON
}
So there is a fixes string "RRR This is the ...." and a variable part, the date and time. Ah, and BTW, the string is always the same length.
How do i use FileBeats or LogStash to strip off that leading string so i only get valid JSON in ES?
2017/03/21 18:26:01.644365 json.go:34: ERR Error decoding JSON: invalid character 'R' looking for beginning of value
2017/03/21 18:26:01.644428 json.go:34: ERR Error decoding JSON: json: cannot unmarshal number into Go value of type map[string]interface {}
Do not configure Filebeat to treat the input as JSON, because it isn't JSON. Do make sure to configure the multiline feature so the lines are joined into a single logical message.
I don't see how the source option for your json filter could make sense. Where does the data field come from?
Replace %{DATA:todelete} with %{DATA} and you won't need remove_field. You can also use a mutate filter's gsub option to trim the message field in-place.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.