Class: LogStash::Outputs::Tcp

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

Instance Attribute Summary

Attributes inherited from Base

#logger

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#receive(event) ⇒ Object



18
19
20
21
# File 'lib/logstash/outputs/tcp.rb', line 18

def receive(event)
  @connection.send_data(event.to_hash.to_json)
  @connection.send_data("\n")
end

#registerObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/logstash/outputs/tcp.rb', line 6

def register
  # TODO(sissel): Write generic validation methods
  if !@url.host or !@url.port
    @logger.fatal("No host or port given in #{self.class}: #{@url}")
    # TODO(sissel): Make this an actual exception class
    raise "configuration error"
  end

  @connection = EventMachine::connect(@url.host, @url.port)
end