Skip to content

Commit

Permalink
- use first element if fields['message'] is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed May 27, 2011
1 parent b768ae7 commit db50c70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/logstash/outputs/gelf.rb
Expand Up @@ -62,7 +62,13 @@ def receive(event)
# We have to make our own hash here because GELF expects a hash
# with a specific format.
m = Hash.new
m["short_message"] = (event.fields["message"] or event.message)
if event.fields["message"]
v = event.fields["message"]
m["short_message"] = (v.is_a?(array) && v.length == 1) ? v.first : v
else
m["short_message"] = event.message
end

m["full_message"] = (event.message)
m["host"] = event["@source_host"]
m["file"] = event["@source_path"]
Expand Down

0 comments on commit db50c70

Please sign in to comment.