diff options
author | Saku Ytti <saku@ytti.fi> | 2015-03-13 13:31:04 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2015-03-13 13:31:04 +0200 |
commit | fb0e4e191af9bd686a64d055700e1d0ef7c39c8b (patch) | |
tree | fe5828dcb7a44ad59d0f5237a382963959cb93c8 /extra/syslog.rb | |
parent | 02b3b0f8f15b22248c873170e970d8e3dcd22b31 (diff) |
default to port 514
Diffstat (limited to 'extra/syslog.rb')
-rw-r--r-- | extra/syslog.rb | 7 |
1 files changed, 4 insertions, 3 deletions
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 |