Class: LogStash::Inputs::Gelf

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

Overview

Read gelf messages as events over the network.

This input is a good choice if you already use graylog2 today.

The main reasoning for this input is to leverage existing GELF logging libraries such as the gelf log4j appender

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

#tag

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

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

Constructor Details

#initialize(params) ⇒ Gelf

Returns a new instance of Gelf.



48
49
50
51
# File 'lib/logstash/inputs/gelf.rb', line 48

def initialize(params)
  super
  BasicSocket.do_not_reverse_lookup = true
end

Instance Method Details

#registerObject



54
55
56
57
# File 'lib/logstash/inputs/gelf.rb', line 54

def register
  require 'gelfd'
  @udp = nil
end

#run(output_queue) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/logstash/inputs/gelf.rb', line 60

def run(output_queue)
  begin
    # udp server
    udp_listener(output_queue)
  rescue => e
    @logger.warn("gelf listener died", :exception => e, :backtrace => e.backtrace)
    sleep(5)
    retry
  end # begin
end