From 251952ff1d4e0450ca0dbfaa3693843167d01743 Mon Sep 17 00:00:00 2001 From: Grant Rodgers Date: Thu, 19 Jul 2012 13:35:09 -0700 Subject: [PATCH] print hash values as json --- lib/logstash/event.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/logstash/event.rb b/lib/logstash/event.rb index c9dc1ce28..bb8c67195 100644 --- a/lib/logstash/event.rb +++ b/lib/logstash/event.rb @@ -243,11 +243,13 @@ class LogStash::Event end # key.split.each end # if self[key] - # TODO(petef): what if value.is_a?(Hash)? - if value.nil? + case value + when nil tok # leave the %{foo} if this field does not exist in this event. - elsif value.is_a?(Array) - value.join(",") # Join by ',' if value is an rray + when Array + value.join(",") # Join by ',' if value is an array + when Hash + value.to_json # Convert hashes to json else value # otherwise return the value end