Class: DLogger::Output::LogStash

Inherits:
Base
  • Object
show all
Defined in:
lib/dlogger/outputs/em/logstash.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ LogStash

Returns a new instance of LogStash.



22
23
24
25
26
# File 'lib/dlogger/outputs/em/logstash.rb', line 22

def initialize(host, port)
  @host = host
  @port = port
  connect
end

Instance Method Details

#connectObject



28
29
30
# File 'lib/dlogger/outputs/em/logstash.rb', line 28

def connect
  @socket = EM::connect(@host, @port, LogStashHandler, self)
end

#dispatch(msg, metadata) ⇒ Object



32
33
34
35
# File 'lib/dlogger/outputs/em/logstash.rb', line 32

def dispatch(msg, )
   = .merge(:message => msg)
  @socket.send_data( MultiJson.encode() + "\n" )
end