Hi there!
Im having a issue (random I think) when using mutate and split. This is my logstash config
input {
kafka {
bootstrap_servers => "localhost:9092"
topics => ["topic"]
}
}
filter {
mutate {
split => ["message",","]
add_field => { "field-a" => "%{[message][0]}"}
}
mutate {
split => ["message",","]
add_field => { "field-b" => "%{[message][1]}"}
}
mutate {
split => ["message",","]
add_field => { "field-c" => "%{[message][2]}"}
}
mutate {
split => ["message",","]
add_field => { "field-d" => "%{[message][3]}"}
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "index"
}
}
An Im getting at index tiem the following entries duplicated
hits" : [
{
"_index" : "index",
"_type" : "_doc",
"_id" : "wvnd3mwB1Aphc7auPmoX",
"_score" : 1.0,
"_source" : {
"field-c" : [
"11",
"11",
"11"
],
"field-b" : [
"00211",
"00211",
"00211"
],
"@timestamp" : "2019-08-29T19:32:16.745Z",
"@version" : "1",
"message" : [
"sgit",
"00211",
"11",
"pendiente"
],
"field-a" : [
"sgit",
"sgit",
"sgit"
],
"field-d" : [
"pendiente",
"pendiente",
"pendiente"
]
}
}
I don't know why it's triplicates the values for each field. Take note that the message list gives me one value per field
I also changed my logstash config to this, with the same results
filter {
mutate {
add_field => { "field-a" => "%{[message][0]}"}
}
mutate {
add_field => { "field-b" => "%{[message][1]}"}
}
mutate {
add_field => { "field-c" => "%{[message][2]}"}
}
mutate {
add_field => { "field-d" => "%{[message][3]}"}
}
}