Lowercase a field's value


(Kartik Ramachandran) #1

I am trying to lowercase the value of only 1 filed in logstash. From the old threads, i see that the lowercase filter does not help. So, i tried using

ruby {
code => "event.to_hash.each{|k, v| v.downcase! if v.is_a?(String)}"
}

But the above lowercases all fields.

If i try using event['field'].to... ==> i get the error
Ruby exception occurred: undefined method `to_hash' for nil:NilClass {:level=>:error, :file=>"logstash/filters/ruby.rb", :line=>"41", :method=>"filter"}

How can i lowercase the value of ONLY one field after i parse the message?

Please let me know.

Thanks.


(Kartik Ramachandran) #2

with the new logstash release, lowercase works fine.

thanks.


(system) #3