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

Version Path
logstash-lite-0.2.20101201111523 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101129210156 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101129205551 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101129155412 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101124030048 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101124004656 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101123134625 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101123133737 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101120024757 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101120021802 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101119183130 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101118141920 lib/logstash/inputs/base.rb
logstash-lite-0.2.20101118134500 lib/logstash/inputs/base.rb