HALP! Changing two backslashes to one!

In case you ever do need to do it (or someone's forum search gets a hit on your title) it is hard to get logstash to allow a backslash before the closing quote surrounding a string, so you represent each backslash using one occurrence of the character class that only includes backslash, then use a capture group in the replacement string

mutate { gsub => [ "someField", "([\\])[\\]", "\1" ] }
1 Like