Class: LogStash::Inputs::Lumberjack

Inherits:
Base show all
Defined in:
lib/logstash/inputs/lumberjack.rb

Overview

Receive events using the lumberjack protocol.

This is mainly to receive events shipped with lumberjack, <github.com/jordansissel/lumberjack>

Constant Summary

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes inherited from Base

#params, #threadable

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Base

#initialize, #tag

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Inputs::Base

Instance Method Details

#registerObject



34
35
36
37
38
39
40
41
# File 'lib/logstash/inputs/lumberjack.rb', line 34

def register
  require "lumberjack/server"

  @logger.info("Starting lumberjack input listener", :address => "#{@host}:#{@port}")
  @lumberjack = Lumberjack::Server.new(:address => @host, :port => @port,
    :ssl_certificate => @ssl_certificate, :ssl_key => @ssl_key,
    :ssl_key_passphrase => @ssl_key_passphrase)
end

#run(output_queue) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/logstash/inputs/lumberjack.rb', line 44

def run(output_queue)
  @lumberjack.run do |l|
    @codec.decode(l.delete("line")) do |event|
      decorate(event)
      l.each { |k,v| event[k] = v; v.force_encoding("UTF-8") }
      output_queue << event
    end
  end
end