Class: LogStash::Inputs::Syslog::UDPInput

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/logstash/inputs/syslog.rb

Instance Method Summary collapse

Constructor Details

#initialize(receiver, logger) ⇒ UDPInput

Returns a new instance of UDPInput.



116
117
118
119
# File 'lib/logstash/inputs/syslog.rb', line 116

def initialize(receiver, logger)
  @logger = logger
  @receiver = receiver
end

Instance Method Details

#receive_data(data) ⇒ Object

Every udp packet is a unique message.



122
123
124
125
126
# File 'lib/logstash/inputs/syslog.rb', line 122

def receive_data(data)
  port, host = Socket.unpack_sockaddr_in(self.get_peername)
  # Trim trailing newlines 
  @receiver.receive(host, port, data.chomp)
end