Class: LogStash::Filters::Clone

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/filters/clone.rb

Overview

The clone filter is for duplicating events. A clone will be created for each type in the clone list. The original event is left unchanged. Created events are inserted into the pipeline as normal events and will be processed by the remaining pipeline configuration starting from the filter that generated them (i.e. this plugin).

Instance Method Summary collapse

Instance Method Details

#filter(event) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/logstash/filters/clone.rb', line 24

def filter(event)
  @clones.each do |type|
    clone = event.clone
    clone.set("type", type)
    filter_matched(clone)
    @logger.debug("Cloned event", :clone => clone, :event => event)

    # Push this new event onto the stack at the LogStash::FilterWorker
    yield clone
  end
end

#registerObject



19
20
21
# File 'lib/logstash/filters/clone.rb', line 19

def register
  logger.warn("The parameter 'clones' is empty, so no clones will be created.") if @clones.empty?
end