I have some log with json type. Im using filter json for my log.
My config look like
filter {
if [type] == "wifishop" {
json {
source => "message"
target => "frt.wifi"
remove_field => ["message"]
}
if [frt][wifi][IPWan] {
geoip {
id => "frt-wifi-geoip_IPWan-city"
source => "[frt][wifi][IPWan]"
default_database_type => "City"
target => "[frt][wifi][geoip]"
database => "/etc/logstash/GeoLite2-City.mmdb"
}
geoip {
id => "frt-wifi-geoip_IPWan-asn"
source => "[frt][wifi][IPWan]"
default_database_type => "ASN"
target => "[frt][wifi][geoip]"
database => "/etc/logstash/GeoLite2-ASN.mmdb"
}
translate {
regex => true
dictionary_path => "/etc/logstash/translates/frt-ipshop-bo.yaml"
field => "[frt][wifi][IPWan]"
add_field => { "[frt][wifi][value]" => "translated" }
}
json {
source => "translation"
#remove_field => ["translation"]
}
mutate {
add_field => { "[frt][wifi][checkip]" => "true" }
}
} else {
mutate {
add_field => { "[frt][wifi][checkip]" => "false" }
}
}
mutate {
convert => { "[frt][wifi][DownloadResult][AverageSpeed]" => "float" }
convert => { "frt.wifi.DownloadResult.MaxSpeed" => "float" }
convert => { "frt.wifi.DownloadResult.MinSpeed" => "float" }
convert => { "frt.wifi.UploadResult.AverageSpeed" => "float" }
convert => { "frt.wifi.UploadResult.MaxSpeed" => "float" }
convert => { "frt.wifi.UploadResult.MinSpeed" => "float" }
convert => { "frt.wifi.WifiResult.Frequency" => "float" }
convert => { "frt.wifi.WifiResult.LinkSpeed" => "float" }
add_field => { "frt.wifi.value" => "mutated" }
#remove_tag => ["beats_input_codec_plain_applied","_grokparsefailure","_geoip_lookup_failure"]
}
}
}
And this is log in kibana after filtered
After first json filter
json {
source => "message"
target => "frt.wifi"
remove_field => ["message"]
}
i got all field with prefix "frt.wifi.*" but when i check field [frt][wifi][IPWan], why it jump to else condition
if [frt][wifi][IPWan] {
........
} else {
mutate {
add_field => { "[frt][wifi][checkip]" => "false" }
}
}
What happen? something wrong in my config ?