Class: LogStash::Inputs::Base
- Includes:
- Config::Mixin, Util::Loggable
- 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::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
Class Method Summary collapse
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 included from Util::Loggable
included, #logger, #slow_logger
Methods inherited from Plugin
#close, #config_name, #debug_info, #do_close, #eql?, #hash, #id, #inspect, lookup, #metric, #metric=, #reloadable?, reloadable?, #to_s
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
58 59 60 61 62 63 64 |
# File 'lib/logstash/inputs/base.rb', line 58 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.
50 51 52 |
# File 'lib/logstash/inputs/base.rb', line 50 def params @params end |
#threadable ⇒ Object
Returns the value of attribute threadable.
51 52 53 |
# File 'lib/logstash/inputs/base.rb', line 51 def threadable @threadable end |
Class Method Details
.plugin_type ⇒ Object
53 54 55 |
# File 'lib/logstash/inputs/base.rb', line 53 def self.plugin_type "input" end |
Instance Method Details
#do_stop ⇒ Object
86 87 88 89 90 |
# File 'lib/logstash/inputs/base.rb', line 86 def do_stop @logger.debug("stopping", :plugin => self.class.name) @stop_called.make_true stop end |
#register ⇒ Object
67 68 69 |
# File 'lib/logstash/inputs/base.rb', line 67 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
81 82 83 |
# File 'lib/logstash/inputs/base.rb', line 81 def stop # override if necessary end |
#stop? ⇒ Boolean
94 95 96 |
# File 'lib/logstash/inputs/base.rb', line 94 def stop? @stop_called.value end |
#tag(newtag) ⇒ Object
72 73 74 |
# File 'lib/logstash/inputs/base.rb', line 72 def tag(newtag) @tags << newtag end |