mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Merge pull request #175 from grantr/hash_to_json
Represent hash values as json (LOGSTASH-528)
This commit is contained in:
commit
b0e0923057
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue