Class: LogStash::Outputs::UDP
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::UDP
- Defined in:
- lib/logstash/outputs/udp.rb
Overview
Send events over UDP
Keep in mind that UDP is a lossy protocol
Instance Method Summary collapse
Instance Method Details
#receive(event) ⇒ Object
42 43 44 |
# File 'lib/logstash/outputs/udp.rb', line 42 def receive(event) @codec.encode(event) end |
#register ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/logstash/outputs/udp.rb', line 27 def register @socket = UDPSocket.new @codec.on_event do |event, payload| port = event.sprintf(@port) begin port = Integer(port) rescue => e # ArgumentError (invalid value for Integer(): "foo") logger.error("Failed to resolve port, dropping event", port: @port, event: event.to_hash, message: e.) else socket_send(payload, port) end end end |