mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
Merge pull request #95 from dinomite/fbb619fd8355486e1d4ad68755972168502bcdca
Add filtering by fields to output plugins (LOGSTASH-392)
This commit is contained in:
commit
11658e79d7
1 changed files with 11 additions and 0 deletions
|
@ -22,6 +22,10 @@ class LogStash::Outputs::Base < LogStash::Plugin
|
|||
# Optional.
|
||||
config :tags, :validate => :array, :default => []
|
||||
|
||||
# Only handle events with all of these fields.
|
||||
# Optional.
|
||||
config :fields, :validae => :array, :default => []
|
||||
|
||||
public
|
||||
def initialize(params)
|
||||
super
|
||||
|
@ -64,6 +68,13 @@ class LogStash::Outputs::Base < LogStash::Plugin
|
|||
end
|
||||
end
|
||||
|
||||
if !@fields.empty?
|
||||
if (event.fields.keys & @fields).size != @fields.size
|
||||
@logger.debug(["Dropping event because type doesn't match #{@fields.inspect}", event])
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end # class LogStash::Outputs::Base
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue