mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- use first element if fields['message'] is an array
This commit is contained in:
parent
b768ae72b6
commit
db50c70778
1 changed files with 7 additions and 1 deletions
|
@ -62,7 +62,13 @@ class LogStash::Outputs::Gelf < LogStash::Outputs::Base
|
|||
# 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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue