Class: LogStash::Inputs::Base
- Includes:
- Config::Mixin
- Defined in:
- lib/logstash/inputs/base.rb
Overview
This is the base class for Logstash inputs.
Direct Known Subclasses
Constant Summary
Constants included from Config::Mixin
Config::Mixin::ALLOW_ENV_FLAG, Config::Mixin::ENV_PLACEHOLDER_REGEX, Config::Mixin::PLUGIN_VERSION_0_9_0, Config::Mixin::PLUGIN_VERSION_1_0_0
Constants inherited from Plugin
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#threadable ⇒ Object
Returns the value of attribute threadable.
Attributes included from Config::Mixin
Attributes inherited from Plugin
Instance Method Summary collapse
- #do_stop ⇒ Object
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
- #register ⇒ Object
-
#stop ⇒ Object
override stop if you need to do more than do_stop to enforce the input plugin to return from ‘run`.
- #stop? ⇒ Boolean
- #tag(newtag) ⇒ Object
Methods included from Config::Mixin
#config_init, included, #replace_env_placeholders
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.
52 53 54 55 56 57 58 |
# File 'lib/logstash/inputs/base.rb', line 52 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 |
Instance Method Details
#do_stop ⇒ Object
80 81 82 83 84 |
# File 'lib/logstash/inputs/base.rb', line 80 def do_stop @logger.debug("stopping", :plugin => self) @stop_called.make_true stop end |
#register ⇒ Object
61 62 63 |
# File 'lib/logstash/inputs/base.rb', line 61 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
75 76 77 |
# File 'lib/logstash/inputs/base.rb', line 75 def stop # override if necessary end |
#stop? ⇒ Boolean
88 89 90 |
# File 'lib/logstash/inputs/base.rb', line 88 def stop? @stop_called.value end |
#tag(newtag) ⇒ Object
66 67 68 |
# File 'lib/logstash/inputs/base.rb', line 66 def tag(newtag) @tags << newtag end |