Class: LogStash::Inputs::Base
- Inherits:
- 
      Plugin
      
        - Object
- Plugin
- 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::PLUGIN_VERSION_0_9_0, Config::Mixin::PLUGIN_VERSION_1_0_0
Constants included from Util::SubstitutionVariables
Util::SubstitutionVariables::SUBSTITUTION_PLACEHOLDER_REGEX
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
- #clone ⇒ Object
- #do_stop ⇒ Object
- #execution_context=(context) ⇒ 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
Methods included from Util::SubstitutionVariables
#deep_replace, #replace_placeholders
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of 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
| 102 103 104 105 106 107 108 109 110 | # File 'lib/logstash/inputs/base.rb', line 102 def execution_context=(context) super # There is no easy way to propage an instance variable into the codec, because the codec # are created at the class level # TODO(talevy): Codecs should have their own execution_context, for now they will inherit their # parent plugin's @codec.execution_context = context context 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 # override if necessary 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 |