In logstash 2.1 I have been using a ruby filter to loop through all top-level fields and do a gsub to remove some special characters. I know that in 5.0, the Event API has changed significantly with an impact on ruby filters, namely the use of getters and setters instead of directly changing field values. My filter looked like this:
ruby {
code => "
event.to_hash.each { |k,v|
v.gsub!('badcharacter', 'replacementChar') if v.is_a?(String)
}
"
}
The refactoring of the gsub should not be difficult. However, my filter does not specify what fields to replace, it acts on all fields. With the new Event API, is there still functionality like event.to_hash.each { |k,v|
that would allow me to abstractly apply my gsub filter to all fields??