mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
Fixes LOGSTASH-782: Gelf output level option
Level option now works correctly: picks the first valid entry in the array.
This commit is contained in:
parent
a169739c7d
commit
21859c5944
1 changed files with 7 additions and 7 deletions
|
@ -29,7 +29,7 @@ class LogStash::Outputs::Gelf < LogStash::Outputs::Base
|
||||||
# useful if you want to parse the 'log level' from an event and use that
|
# useful if you want to parse the 'log level' from an event and use that
|
||||||
# as the gelf level/severity.
|
# as the gelf level/severity.
|
||||||
#
|
#
|
||||||
# Values here can be integers [0..7] inclusive or any of
|
# Values here can be integers [0..7] inclusive or any of
|
||||||
# "debug", "info", "warn", "error", "fatal", "unknown" (case insensitive).
|
# "debug", "info", "warn", "error", "fatal", "unknown" (case insensitive).
|
||||||
# Single-character versions of these are also valid, "d", "i", "w", "e", "f",
|
# Single-character versions of these are also valid, "d", "i", "w", "e", "f",
|
||||||
# "u"
|
# "u"
|
||||||
|
@ -88,9 +88,9 @@ class LogStash::Outputs::Gelf < LogStash::Outputs::Base
|
||||||
|
|
||||||
# If we leave that set, the gelf gem will extract the file and line number
|
# If we leave that set, the gelf gem will extract the file and line number
|
||||||
# of the source file that logged the message (i.e. logstash/gelf.rb:138).
|
# of the source file that logged the message (i.e. logstash/gelf.rb:138).
|
||||||
# With that set to false, it can use the actual event's filename (i.e.
|
# With that set to false, it can use the actual event's filename (i.e.
|
||||||
# /var/log/syslog), which is much more useful
|
# /var/log/syslog), which is much more useful
|
||||||
@gelf.collect_file_and_line = false
|
@gelf.collect_file_and_line = false
|
||||||
|
|
||||||
# these are syslog words and abbreviations mapped to RFC 5424 integers
|
# these are syslog words and abbreviations mapped to RFC 5424 integers
|
||||||
@level_map = {
|
@level_map = {
|
||||||
|
@ -162,10 +162,10 @@ class LogStash::Outputs::Gelf < LogStash::Outputs::Base
|
||||||
if @level.is_a?(Array)
|
if @level.is_a?(Array)
|
||||||
@level.each do |value|
|
@level.each do |value|
|
||||||
parsed_value = event.sprintf(value)
|
parsed_value = event.sprintf(value)
|
||||||
if parsed_value
|
next if value.count('%{') > 0 and parsed_value == value
|
||||||
level = parsed_value
|
|
||||||
break
|
level = parsed_value
|
||||||
end
|
break
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
level = event.sprintf(@level.to_s)
|
level = event.sprintf(@level.to_s)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue