вы сделали действительно простую ошибку с вашим mutate split
.
это
mutate {
split => ["description", "_"]
add_field => {"location" => "%{[description][3]}"}
}
должно было быть
mutate {
split => ["description"=> "_"] <=== see I removed the comma and added =>
add_field => {"location" => "%{[description][3]}"}
}
вот образец, который я тестировал с
filter {
mutate {
remove_field => ["headers", "@version"]
add_field => { "description" => "Python_Java_ruby_perl " }
}
mutate {
split => {"description" => "_"}
}
if [description][4] {
mutate {
add_field => {"result" => "The 4 th field exists"}
}
} else {
mutate {
add_field => {"result" => "The 4 th field DOES NOT exists"}
}
}
и результат на консоли (поскольку 4-го элемента нет, он перешел в else
block
{
"host" => "0:0:0:0:0:0:0:1",
"result" => "The 4 th field DOES NOT exists", <==== from else block
"@timestamp" => 2020-01-14T19:35:41.013Z,
"message" => "hello",
"description" => [
[0] "Python",
[1] "Java",
[2] "ruby",
[3] "perl "
]
}