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::CONFIGSORT, 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
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
- #register ⇒ Object
- #tag(newtag) ⇒ Object
Methods included from Config::Mixin
Methods inherited from Plugin
#eql?, #finished, #finished?, #hash, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/logstash/inputs/base.rb', line 67 def initialize(params={}) super @threadable = false config_init(params) @tags ||= [] if @charset && @codec.class.get_config.include?("charset") # charset is deprecated on inputs, but provide backwards compatibility # by copying the charset setting into the codec. @logger.info("Copying input's charset setting into codec", :input => self, :codec => @codec) charset = @charset @codec.instance_eval { @charset = charset } end # Backwards compat for the 'format' setting case @format when "plain"; # do nothing when "json" @codec = LogStash::Plugin.lookup("codec", "json").new when "json_event" @codec = LogStash::Plugin.lookup("codec", "oldlogstashjson").new end end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
63 64 65 |
# File 'lib/logstash/inputs/base.rb', line 63 def params @params end |
#threadable ⇒ Object
Returns the value of attribute threadable.
64 65 66 |
# File 'lib/logstash/inputs/base.rb', line 64 def threadable @threadable end |
Instance Method Details
#register ⇒ Object
94 95 96 |
# File 'lib/logstash/inputs/base.rb', line 94 def register raise "#{self.class}#register must be overidden" end |
#tag(newtag) ⇒ Object
99 100 101 |
# File 'lib/logstash/inputs/base.rb', line 99 def tag(newtag) @tags << newtag end |