Skip to content

Commit

Permalink
Add :fields filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dinomite committed Feb 3, 2012
1 parent ead1677 commit fbb619f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/logstash/outputs/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,6 +68,13 @@ def output?(event)
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

0 comments on commit fbb619f

Please sign in to comment.