Gsub filter not working as expected for dot to underscore conversion


(Gautham) #1

Hi All,

I have been trying to replace dots to underscores in the fieldname using gsub filter and didnt succeeded,
here is my filter

mutate {
    gsub => [
        "caller_id.location.latitude", ".", "_"
        ]
}

there are no errors while executing logstash, but there is no change in the fieldname when i check the output in rubydebug.

Is there something i'm missing or gsub doesnot support this type of conversion, please advice.

Thanks
Gauti


(Guy Boertje) #2

The second string "." is converted to a regex so you will need to escape the dot.


(Gautham) #3

@guyboertje how do i escape that dot? any idea??

Thanks
Gauti


(Guy Boertje) #4

Well you could google it

It is "\."


(system) #5

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