i have kafka input
something like this
{"interactionId":"7891013","applicantInfoList":[{"cif":123456,"role":"Primary","applicantType":"PROSPECT"}],"correlationId":"d828bcf9-0fb7-467b-b2c5-a67c2305a9db","applicationId":"99999","productType":4600,"timestamp":1443713482677}
logstash configuration
input {
file {
path => "/Users/xxx/Desktop/ELK/ELK Infrastructure/kafka_xxx_sample_data.txt"
start_position => "beginning"
}
}
filter {
json {
source => "message"
}
if [applicantInfoList][cif] == 123456 {
mutate {
add_field => {
"new_field" => "Application Accepted"
}
}
}
else if [applicantInfoList][cif] == 7891011 {
mutate {
add_field => {
"new_field" => "Application Rejected"
}
}
}
}
output {
elasticsearch {
action => "index"
hosts => "127.0.0.1:9200"
codec => "plain"
flush_size => 5000
idle_flush_time => 1
index => "logstash-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug }
}
Issue : it is not recognizing nested field [applicantInfoList][cif] because of [ ]
but if i remove [] from input it is able to recognize nested field cif.
how would i solve it without removing it [].