two grep filter bugfixes

- if we receive a message with an unknown type, drop it
- break on first match if there are multiple values (faster & keeps match_count right)
This commit is contained in:
pete fritchman 2010-12-04 17:58:30 -08:00
parent f2d5258115
commit e0594f73c1

View file

@ -33,6 +33,7 @@ class LogStash::Filters::Grep < LogStash::Filters::Base
config = @config[event.type]
if not config
@logger.debug("grep: skipping type #{event.type} from #{event.source}")
event.cancel
return
end
@ -54,6 +55,7 @@ class LogStash::Filters::Grep < LogStash::Filters::Base
next unless re.match(value)
@logger.debug("grep matched on field #{field}")
match_count += 1
break
end
end # match["match"].each