Class: LogStash::Filters::Metaevent

Inherits:
Base show all
Defined in:
lib/logstash/filters/metaevent.rb

Constant Summary

Constants inherited from Base

Base::RESERVED

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Base

#execute, #initialize, #threadsafe?

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Filters::Base

Instance Method Details

#filter(event) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/logstash/filters/metaevent.rb', line 20

def filter(event)
  if filter?(event)
    start_period(event)
  elsif within_period(event)
    if followed_by_tags_match(event)
      trigger(event)
    else
      @logger.debug(["metaevent", @add_tag, "ignoring (tags don't match)", event])
    end
  else
    @logger.debug(["metaevent", @add_tag, "ignoring (not in period)", event])
  end
end

#flushObject



34
35
36
37
38
39
40
# File 'lib/logstash/filters/metaevent.rb', line 34

def flush
  return if @metaevents.empty?

  new_events = @metaevents
  @metaevents = []
  new_events
end

#registerObject



15
16
17
18
# File 'lib/logstash/filters/metaevent.rb', line 15

def register
  @logger.debug("registering")
  @metaevents = []
end