Hi!
One of our logs contains lines of arrays of json objects.... I want to take each one of the items in the array and make it a single even.
I read some posts on how to do it :
https://discuss.elastic.co/t/split-nested-json-array/147969
https://stackoverflow.com/questions/30558535/logstash-how-do-i-split-an-array-using-the-split-filter-without-a-target
But I was not able to make mine work....
Here is what a line looks like for me:
[{"timeStarted": "2019-05-13T09:03:34.995Z","operations": {"operation 1" { ... } "operation 2" { ... }} },{"timeStarted": "2019-05-13T09:03:35.000Z","operations": {"operation 1" { ... } "operation 2" { ... }} ]
and this is what I tried with my conf:
filter {
split {
field => "message"
target => "events"
add_field => {
"operations" => "%{operations}"
"timeStarted" => "%{timeStarted}"
}
}
mutate {
add_field => {
"site" => "%{path}"
#"operations" => "%{[events][operations]"
#"timeStarted" => "%{[events][timeStarted]"
}
remove_field => ["[message]"]
}
date {
match => ["[timeStarted]", "yyyy-MM-dd'T'HH:mm:ss.SSS"]
}
}
I tried different options, but I could not get the fields out. I only get 1 event per line and get parse error for the fields...
I tried adding the fields both as part of the split and as part of a mutate, neither of them worked for me
any idea?
Thanks!!!