From fb0e4e191af9bd686a64d055700e1d0ef7c39c8b Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Fri, 13 Mar 2015 13:31:04 +0200 Subject: default to port 514 --- extra/syslog.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'extra') diff --git a/extra/syslog.rb b/extra/syslog.rb index f39b612..399cef3 100644 --- a/extra/syslog.rb +++ b/extra/syslog.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # IOS: -# logging discriminator CFG mnemonics includes CONFIG_I +# logging discriminator CFG mnemonics includes CONFIG_I # logging host SERVER discriminator CFG # JunOS: @@ -31,6 +31,7 @@ module Oxidized class << self def udp port=PORT, listen=0 + port ||= PORT io = UDPSocket.new io.bind listen, port new io, :udp @@ -42,7 +43,7 @@ module Oxidized end end - private + private def initialize io, mode=:udp @mode = mode @@ -86,7 +87,7 @@ module Oxidized if @mode == :udp log, ip = log.recvfrom_nonblock 2000 ip = ip.last - else + else begin log = log.read_nonblock 2000 rescue EOFError -- cgit v1.2.1