Class: LogStash::Inputs::Base
- Inherits:
-
Plugin
- Object
- Plugin
- LogStash::Inputs::Base
show all
- Includes:
- Config::Mixin, Util::Loggable
- Defined in:
- lib/logstash/inputs/base.rb
Overview
This is the base class for Logstash inputs.
Constant Summary
Config::Mixin::PLUGIN_VERSION_0_9_0, Config::Mixin::PLUGIN_VERSION_1_0_0
Util::SubstitutionVariables::SUBSTITUTION_PLACEHOLDER_REGEX
Instance Attribute Summary collapse
#config, #original_params
Class Method Summary
collapse
Instance Method Summary
collapse
#config_init, included
#deep_replace, #replace_placeholders
Constructor Details
#initialize(params = {}) ⇒ Base
56
57
58
59
60
61
62
|
# File 'lib/logstash/inputs/base.rb', line 56
def initialize(params={})
super
@threadable = false
@stop_called = Concurrent::AtomicBoolean.new(false)
config_init(@params)
@tags ||= []
end
|
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
48
49
50
|
# File 'lib/logstash/inputs/base.rb', line 48
def params
@params
end
|
#threadable ⇒ Object
Returns the value of attribute threadable.
49
50
51
|
# File 'lib/logstash/inputs/base.rb', line 49
def threadable
@threadable
end
|
Class Method Details
.plugin_type ⇒ Object
51
52
53
|
# File 'lib/logstash/inputs/base.rb', line 51
def self.plugin_type
"input"
end
|
Instance Method Details
#clone ⇒ Object
96
97
98
99
100
|
# File 'lib/logstash/inputs/base.rb', line 96
def clone
cloned = super
cloned.codec = @codec.clone if @codec
cloned
end
|
#do_stop ⇒ Object
84
85
86
87
88
|
# File 'lib/logstash/inputs/base.rb', line 84
def do_stop
@logger.debug("Stopping", :plugin => self.class.name)
@stop_called.make_true
stop
end
|
#execution_context=(context) ⇒ Object
109
110
111
112
113
114
115
116
117
|
# File 'lib/logstash/inputs/base.rb', line 109
def execution_context=(context)
super
@codec.execution_context = context
context
end
|
#metric=(metric) ⇒ Object
102
103
104
105
106
107
|
# File 'lib/logstash/inputs/base.rb', line 102
def metric=(metric)
super
@codec.metric = metric.root.namespace(metric.namespace_name[0...-2].push(:codecs, codec.id))
metric
end
|
#register ⇒ Object
65
66
67
|
# File 'lib/logstash/inputs/base.rb', line 65
def register
raise "#{self.class}#register must be overidden"
end
|
#stop ⇒ Object
override stop if you need to do more than do_stop to enforce the input plugin to return from run. e.g. a tcp plugin might need to close the tcp socket so blocking read operation aborts
79
80
81
|
# File 'lib/logstash/inputs/base.rb', line 79
def stop
end
|
#stop? ⇒ Boolean
92
93
94
|
# File 'lib/logstash/inputs/base.rb', line 92
def stop?
@stop_called.value
end
|
#tag(newtag) ⇒ Object
70
71
72
|
# File 'lib/logstash/inputs/base.rb', line 70
def tag(newtag)
@tags << newtag
end
|