class LogStash::Inputs::Base
This is the base class for logstash inputs.
Attributes
params[RW]
threadable[RW]
Public Class Methods
new(params={})
click to toggle source
Calls superclass method
LogStash::Plugin::new
# File lib/logstash/inputs/base.rb, line 70 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
Public Instance Methods
register()
click to toggle source
# File lib/logstash/inputs/base.rb, line 97 def register raise "#{self.class}#register must be overidden" end
tag(newtag)
click to toggle source
# File lib/logstash/inputs/base.rb, line 102 def tag(newtag) @tags << newtag end
Protected Instance Methods
decorate(event)
click to toggle source
# File lib/logstash/inputs/base.rb, line 112 def decorate(event) # Only set 'type' if not already set. This is backwards-compatible behavior event["type"] = @type if @type && !event.include?("type") if @tags.any? event["tags"] ||= [] event["tags"] += @tags end @add_field.each do |field, value| event[field] = value end end
to_event(raw, source)
click to toggle source
# File lib/logstash/inputs/base.rb, line 107 def to_event(raw, source) raise LogStash::ThisMethodWasRemoved("LogStash::Inputs::Base#to_event - you should use codecs now instead of to_event. Not sure what this means? Get help on logstash-users@googlegroups.com!") end