Class: LogStash::Outputs::Base

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

Constant Summary

Constants included from Config::Mixin

Config::Mixin::PLUGIN_VERSION_0_9_0, Config::Mixin::PLUGIN_VERSION_1_0_0

Constants inherited from Plugin

Plugin::NL

Instance Attribute Summary collapse

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#close, #debug_info, #do_close, #eql?, #hash, #inspect, lookup, #to_s

Constructor Details

#initialize(params = {}) ⇒ Base

Returns a new instance of Base.



61
62
63
64
65
66
67
68
# File 'lib/logstash/outputs/base.rb', line 61

def initialize(params={})
  super
  config_init(@params)

  # If we're running with a single thread we must enforce single-threaded concurrency by default
  # Maybe in a future version we'll assume output plugins are threadsafe
  @single_worker_mutex = Mutex.new
end

Instance Attribute Details

#available_workersObject (readonly)

Returns the value of attribute available_workers.



28
29
30
# File 'lib/logstash/outputs/base.rb', line 28

def available_workers
  @available_workers
end

#worker_pluginsObject (readonly)

Returns the value of attribute worker_plugins.



28
29
30
# File 'lib/logstash/outputs/base.rb', line 28

def worker_plugins
  @worker_plugins
end

#workersObject (readonly)

Returns the value of attribute workers.



28
29
30
# File 'lib/logstash/outputs/base.rb', line 28

def workers
  @workers
end

#workers_not_supported(message = nil) ⇒ Object (readonly)

TODO: Remove this in the next major version after Logstash 2.x Post 2.x it should raise an error and tell people to use the class level declaration



56
57
58
# File 'lib/logstash/outputs/base.rb', line 56

def workers_not_supported
  @workers_not_supported
end

Class Method Details

.declare_threadsafe!Object



30
31
32
33
# File 'lib/logstash/outputs/base.rb', line 30

def self.declare_threadsafe!
  declare_workers_not_supported!
  @threadsafe = true
end

.declare_workers_not_supported!(message = nil) ⇒ Object



39
40
41
42
# File 'lib/logstash/outputs/base.rb', line 39

def self.declare_workers_not_supported!(message=nil)
  @workers_not_supported_message = message
  @workers_not_supported = true
end

.threadsafe?Boolean

Returns:

  • (Boolean)


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

def self.threadsafe?
  @threadsafe == true
end

.workers_not_supported?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/logstash/outputs/base.rb', line 48

def self.workers_not_supported?
  !!@workers_not_supported
end

.workers_not_supported_messageObject



44
45
46
# File 'lib/logstash/outputs/base.rb', line 44

def self.workers_not_supported_message
  @workers_not_supported_message
end

Instance Method Details

#multi_receive(events) ⇒ Object

To be overriden in implementations



82
83
84
# File 'lib/logstash/outputs/base.rb', line 82

def multi_receive(events)
  events.each {|event| receive(event) }
end

#receive(event) ⇒ Object



76
77
78
# File 'lib/logstash/outputs/base.rb', line 76

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

#registerObject



71
72
73
# File 'lib/logstash/outputs/base.rb', line 71

def register
  raise "#{self.class}#register must be overidden"
end