class LogStash::Filters::Urldecode
The urldecode filter is for decoding fields that are urlencoded.
Public Instance Methods
filter(event)
click to toggle source
# File lib/logstash/filters/urldecode.rb, line 23 def filter(event) return unless filter?(event) # If all_fields is true then try to decode them all if @all_fields event.to_hash.each do |name, value| event[name] = urldecode(value) end # Else decode the specified field else event[@field] = urldecode(event[@field]) end filter_matched(event) end
register()
click to toggle source
# File lib/logstash/filters/urldecode.rb, line 18 def register # Nothing to do end
Private Instance Methods
urldecode(value)
click to toggle source
Attempt to handle string, array, and hash values for fields. For all other datatypes, just return, URI.unescape doesn't support them.
# File lib/logstash/filters/urldecode.rb, line 41 def urldecode(value) case value when String return URI.unescape(value) when Array ret_values = [] value.each { |v| ret_values << urldecode(v) } return ret_values when Hash ret_values = {} value.each { |k,v| ret_values[k] = urldecode(v) } return ret_values else return value end end