Hi,
I have following incoming data
{"event":[{"duration":"3","time":"2019-02-04 17:49:27","event":"achievementUnlock","message":"Achievement unlocked"},{"duration":"5","time":"2019-02-04 17:49:27","event":"achievementUnlock","message":"Achievement unlocked"},{"duration":"6","time":"2019-02-04 17:49:27","event":"achievementUnlock","message":"Achievement unlocked"}]}
Need to push each element of event array as a separate entry to elastic
one document will look like this
hits:[
"_source": {
"@timestamp": "2019-02-04T09:44:20.379Z",
"duration":"3"
"time":2019-02-04
"event": achievementUnlock
"message":Achievement unlocked,
"@version": "1"
},
{
"_source": {
"@timestamp": "2019-02-04T09:44:20.379Z",
"duration":"5"
"time":2019-02-04
"event": achievementUnlock
"message":Achievement unlocked,
"@version": "1"
}
}
]
instead I am getting it in below format
"hits": [
{
"_source": {
"event": {
"time": "2019-02-04 17:43:29",
"event": "achievementUnlock",
"duration": "3",
"message": "Achievement unlocked"
},
"@version": "1",
"@timestamp": "2019-02-04T12:13:29.957Z"
}
},
{
"_source": {
"event": {
"time": "2019-02-04 17:43:29",
"event": "achievementUnlock",
"duration": "5",
"message": "Achievement unlocked"
},
"@version": "1",
"@timestamp": "2019-02-04T12:13:29.957Z"
}
}
logstash conf I am using is below
input{
rabbitmq {
host => "localhost"
queue => "logger_queues"
durable =>false
codec=>json
}
}
filter{
split {
field => "event"
}
date {
match => [ "time", "YYYY-MM-dd HH:mm:ss" ]
target => "@timestamp"
}
}
output{
elasticsearch{
hosts => "localhost"
index => "test"
document_type => "test"
}
}