Using gsub to replace an unknown amount of multiple white space to single whitespace

Hi guys,

Does anyone know how to replace multiple whitespace using gsub?

Below doesn't work - but something like this?

 gsub => [
                "syslog_event", "\s+", " ",
                ]

Thanks

It works for me. These

    mutate { add_field => { "someField" => "a     b" } }
    mutate { gsub => [ "someField", "\s+", " " ] }

result in

 "someField" => "a b",
2 Likes

I had that comma at the end which was causing it to fail (obviously) - Thanks though :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.