Hi all!
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?
This is what i tried so far:
input {
beats {
port => "5043"
}
}
filter {
mutate {
gsub => ["message", "^(.*){", ""]
}
json {
source => "data"
}
date {
match => [ "receivedTime", "UNIX" ]
target => "@timestamp"
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
index => filebeat
}
}
and i keep getting the following message:
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 {}
Thanks,
Ton.