Skip to content

Commit

Permalink
maintain non-String values in gsub when iterating through an Array
Browse files Browse the repository at this point in the history
  • Loading branch information
fetep committed Jul 7, 2012
1 parent bde0aa3 commit 04ad0c3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/logstash/filters/mutate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,12 @@ def gsub(event)
if event[field].is_a?(Array)
event[field] = event[field].map do |v|
if not v.is_a?(String)
@logger.debug("gsub mutation is only applicable for Strings, " +
"skipping", :field => field, :value => event[field])
next
@logger.warn("gsub mutation is only applicable for Strings, " +
"skipping", :field => field, :value => v)
v
else
v.gsub(needle, replacement)
end
v.gsub(needle, replacement)
end
else
if not event[field].is_a?(String)
Expand Down

0 comments on commit 04ad0c3

Please sign in to comment.