mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
LOGSTASH-90: only process events that match our @type. also don't tag _grokparsefailure if we don't have any patterns.
This commit is contained in:
parent
9c36df44ec
commit
11b95e57db
1 changed files with 11 additions and 1 deletions
|
@ -109,6 +109,16 @@ class LogStash::Filters::Grok < LogStash::Filters::Base
|
|||
# parse it with grok
|
||||
match = false
|
||||
|
||||
# Only filter events we are configured for
|
||||
if event.type != @type
|
||||
return
|
||||
end
|
||||
|
||||
if @@grokpiles[event.type].length == 0
|
||||
@logger.debug("Skipping grok for event type=#{event.type} (no grokpiles defined)")
|
||||
return
|
||||
end
|
||||
|
||||
if !event.message.is_a?(Array)
|
||||
messages = [event.message]
|
||||
else
|
||||
|
@ -119,7 +129,7 @@ class LogStash::Filters::Grok < LogStash::Filters::Base
|
|||
@logger.debug(["Running grok filter", event])
|
||||
|
||||
@@grokpiles[event.type].each do |pile|
|
||||
@logger.debug(["Trying pattern", pile])
|
||||
@logger.debug(["Trying pattern for type #{event.type}", pile])
|
||||
grok, match = @pile.match(message)
|
||||
@logger.debug(["Result", { :grok => grok, :match => match }])
|
||||
break if match
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue