Class: LogStash::Inputs::Udp
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Udp
- Defined in:
- lib/logstash/inputs/udp.rb
Overview
Read messages as events over the network via udp. The only required configuration item is ‘port`, which specifies the udp port logstash will listen on for event streams.
Constant Summary collapse
- HOST_FIELD =
"host".freeze
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(params) ⇒ Udp
constructor
A new instance of Udp.
- #register ⇒ Object
-
#run(output_queue) ⇒ Object
def register.
- #stop ⇒ Object
Constructor Details
#initialize(params) ⇒ Udp
Returns a new instance of Udp.
43 44 45 46 |
# File 'lib/logstash/inputs/udp.rb', line 43 def initialize(params) super BasicSocket.do_not_reverse_lookup = true end |
Instance Method Details
#close ⇒ Object
67 68 69 70 71 |
# File 'lib/logstash/inputs/udp.rb', line 67 def close if @udp && !@udp.closed? @udp.close rescue ignore_close_and_log($!) end end |
#register ⇒ Object
48 49 50 51 |
# File 'lib/logstash/inputs/udp.rb', line 48 def register @udp = nil @metric_errors = metric.namespace(:errors) end |
#run(output_queue) ⇒ Object
def register
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/logstash/inputs/udp.rb', line 53 def run(output_queue) @output_queue = output_queue begin # udp server udp_listener(output_queue) rescue => e @logger.warn("UDP listener died", :exception => e, :backtrace => e.backtrace) @metric_errors.increment(:listener) Stud.stoppable_sleep(5) { stop? } retry unless stop? end end |
#stop ⇒ Object
73 74 75 76 77 |
# File 'lib/logstash/inputs/udp.rb', line 73 def stop if @udp && !@udp.closed? @udp.close rescue ignore_close_and_log($!) end end |