Sha256: df179d438950cc17acec611d526bf4d9e063b9a88137c40f23949e04806f90d2
Contents?: true
Size: 1.02 KB
Versions: 9
Compression:
Stored size: 1.02 KB
Contents
require "logstash/namespace" require "logstash/event" require "logstash/logging" require "uri" class LogStash::Inputs::Base attr_accessor :logger public 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 = [] @urlopts = {} if @url.query @urlopts = CGI.parse(@url.query) @urlopts.each do |k, v| @urlopts[k] = v.last if v.is_a?(Array) end end end # def initialize public def register raise "#{self.class}#register must be overidden" end # def register public def tag(newtag) @tags << newtag end # def tag public 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 # def receive end # class LogStash::Inputs::Base
Version data entries
9 entries across 9 versions & 1 rubygems