Sha256: 972128a505b916ecd6708affc77a29c5a3f7d34009084ab66e51ea839893a52a
Contents?: true
Size: 761 Bytes
Versions: 13
Compression:
Stored size: 761 Bytes
Contents
require "logstash/namespace" require "logstash/event" require "logstash/logging" require "uri" class LogStash::Inputs::Base def initialize(url, type, config={}, &block) @logger = LogStash::Logger.new(STDERR) @url = url @url = URI.parse(url) if url.is_a? String @config = config @callback = block @type = type @tags = [] end def register raise "#{self.class}#register must be overidden" end def tag(newtag) @tags << newtag end def receive(event) @logger.debug(["Got event", { :url => @url, :event => event }]) # Only override the type if it doesn't have one event.type = @type if !event.type event.tags |= @tags # set union @callback.call(event) end end # class LogStash::Inputs::Base
Version data entries
13 entries across 13 versions & 1 rubygems