Class: LogStash::Codecs::Base

Inherits:
Plugin
  • Object
show all
Includes:
LogStash::Config::Mixin
Defined in:
lib/logstash/codecs/base.rb

Constant Summary

Constants included from LogStash::Config::Mixin

LogStash::Config::Mixin::CONFIGSORT, LogStash::Config::Mixin::PLUGIN_VERSION_0_9_0, LogStash::Config::Mixin::PLUGIN_VERSION_1_0_0

Constants inherited from Plugin

Plugin::NL

Instance Attribute Summary

Attributes included from LogStash::Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods included from LogStash::Config::Mixin

#config_init, included

Methods inherited from Plugin

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

Constructor Details

#initialize(params = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
# File 'lib/logstash/codecs/base.rb', line 12

def initialize(params={})
  super
  config_init(params)
  register if respond_to?(:register)
end

Instance Method Details

#cloneObject



47
48
49
# File 'lib/logstash/codecs/base.rb', line 47

def clone
  return self.class.new(params)
end

#decode(data) ⇒ Object Also known as: <<



19
20
21
# File 'lib/logstash/codecs/base.rb', line 19

def decode(data)
  raise "#{self.class}#decode must be overidden"
end

#encode(event) ⇒ Object



26
27
28
# File 'lib/logstash/codecs/base.rb', line 26

def encode(event)
  raise "#{self.class}#encode must be overidden"
end

#flush(&block) ⇒ Object



40
41
42
43
44
# File 'lib/logstash/codecs/base.rb', line 40

def flush(&block)
  # does nothing by default.
  # if your codec needs a flush method (like you are spooling things)
  # you must implement this.
end

#on_event(&block) ⇒ Object



35
36
37
# File 'lib/logstash/codecs/base.rb', line 35

def on_event(&block)
  @on_event = block
end

#teardownObject



31
# File 'lib/logstash/codecs/base.rb', line 31

def teardown; end