Class: LogStash::Filters::Clone

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

Overview

The clone filter is for duplicating events. A clone will be made for each type in the clone list. The original event is left unchanged.

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



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

def filter(event)
  return unless filter?(event)
  @clones.each do |type|
    clone = event.clone
    clone["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



17
18
19
# File 'lib/logstash/filters/clone.rb', line 17

def register
  # Nothing to do
end