Fix for LOGSTASH-2164

As discussed in https://logstash.jira.com/browse/LOGSTASH-2164
gsub!() is dangerous to use like this as it returns nil when no substitutions are made.
Replacing with gsub() avoid this.