lib/sensu/server/filter.rb
def event_filter(filter_name, event)
        case
        when @settings.filter_exists?(filter_name)
          native_filter(filter_name, event) do |filtered|
            yield(filtered, filter_name)
          end
        when @extensions.filter_exists?(filter_name)
          extension_filter(filter_name, event) do |filtered|
            yield(filtered, filter_name)
          end
        else
          @logger.error("unknown filter", :filter_name => filter_name)
          yield(false, filter_name)
        end
      end
# Determine if an event is filtered by an event filter, native
# or extension. This method first checks for the existence of a
# native filter, then checks for an extension if a native filter
# is not defined. The provided callback is called with a single
# parameter, indicating if the event was filtered by a filter.
# If a filter does not exist for the provided name, the event is
# not filtered.
#
# @param filter_name [String]
# @param event [Hash]
# @yield [filtered] callback/block called with a single
#   parameter to indicate if the event was filtered.
# @yieldparam filtered [TrueClass,FalseClass] indicating if the
#   event was filtered.
# @yieldparam filter_name [String] name of the filter being evaluated
Determine if an event is filtered by an event filter, native
or extension. This method first checks for the existence of a
native filter, then checks for an extension if a native filter
is not defined. The provided callback is called with a single
parameter, indicating if the event was filtered by a filter.
If a filter does not exist for the provided name, the event is
not filtered.
Determine if an event is filtered by an event filter native or extension . This method first checks for the existence of a native filter then checks for an extension if a native filter is not defined . The provided callback is called with a single parameter indicating if the event was filtered by a filter . If a filter does not exist for the provided name the event is not filtered .
def event_filter(filter_name, event)
        case
        when @settings.filter_exists?(filter_name)
          native_filter(filter_name, event) do |filtered|
            yield(filtered, filter_name)
          end
        when @extensions.filter_exists?(filter_name)
          extension_filter(filter_name, event) do |filtered|
            yield(filtered, filter_name)
          end
        else
          @logger.error("unknown filter", :filter_name => filter_name)
          yield(false, filter_name)
        end
      end
def event_filter ( filter_name , event ) case when @settings . filter_exists? ( filter_name ) native_filter ( filter_name , event ) do | filtered | yield ( filtered , filter_name ) end when @extensions . filter_exists? ( filter_name ) extension_filter ( filter_name , event ) do | filtered | yield ( filtered , filter_name ) end else @logger . error ( "unknown filter" , :filter_name => filter_name ) yield ( false , filter_name ) end end
Determine if an event is filtered by an event filter, native
or extension.
Determine if an event is filtered by an event filter native or extension .
filter_name
name of the filter being evaluated
name of the filter being evaluated
event
None
]
callback/block called with a single parameter to indicate if the event was filtered.
callback / block called with a single parameter to indicate if the event was filtered .
filtered
indicating if the event was filtered.
indicating if the event was filtered .