Class: LanGrove::Protocol::Syslog
- Inherits:
-
Object
- Object
- LanGrove::Protocol::Syslog
- Defined in:
- lib/langrove/protocol/syslog.rb
Instance Method Summary collapse
Instance Method Details
#decode(message) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/langrove/protocol/syslog.rb', line 6 def decode( ) # # eg: # # <NN>Apr 4 11:00:06 fw.school1950.gp-online.net puppet[29206]: Autoloaded file blahblahblah # pass = .split('>')[1].split() time = DateTime.parse(pass[0..2].join(' ')) hostname = pass[3] = pass[4..-1].join(' ').split(': ',2) hostname.gsub!( /vlan[\d]*\./, '') @decoded = { :timestamp => time, # DateTime object :hostname => hostname, # without prepended vlanN :tag => [0], # includes[PID] :event => [1] # everything after the colon after the tag } return @decoded end |