Sha256: 0ce7ee3af8013b81c8fc996c94bc4f6a778e0e8d1b95641ead75c952ddc7c041

Contents?: true

Size: 648 Bytes

Versions: 9

Compression:

Stored size: 648 Bytes

Contents

require "logstash/outputs/base"
require "logstash/namespace"

class LogStash::Outputs::Tcp < LogStash::Outputs::Base
  public
  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 # def register

  public
  def receive(event)
    @connection.send_data(event.to_hash.to_json)
    @connection.send_data("\n")
  end # def receive
end # class LogStash::Outputs::Tcp

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-lite-0.2.20110505142231 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110422152244 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110405105201 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110331121236 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110329105411 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110206003603 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110203130400 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110122143801 lib/logstash/outputs/tcp.rb
logstash-lite-0.2.20110112115019 lib/logstash/outputs/tcp.rb