i have an issue using logstash mutate filter gsub.
Required
Remove "ZC" characters of a field and coverting it into float
{
"field" => "12.343,40ZC",
"@timestamp" => 2020-01-06T23:00:00.000Z
}
Expected output
{
"field" => "-12343,40",
"@timestamp" => 2020-01-06T23:00:00.000Z
}
Code not working
filter{
if "ZC" in "field" {
mutate { gsub => ["field","ZC",""] }
}
}
Code working
filter{
mutate { gsub => ["field","ZC",""] }
}
I need the "if" statement because depends if the two characters exist inside the field to make a positive or negative float.