Class: TSharkParser

Inherits:
Parser show all
Defined in:
lib/gl_tail/parsers/tshark.rb

Overview

Parser which handles tshark logs

Instance Attribute Summary

Attributes inherited from Parser

#source

Instance Method Summary collapse

Methods inherited from Parser

#add_activity, #add_event, inherited, #initialize, registry, #server

Constructor Details

This class inherits a constructor from Parser

Instance Method Details

#parse(line) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gl_tail/parsers/tshark.rb', line 10

def parse( line )
  if(line.include?('->'))
    time, srcip, arrow, destip, type, = line.split(" ")
    add_activity(:block => 'users', :name => srcip)
    add_activity(:block => 'types', :name => type)
  end

  if(line.include?('DNS Standard query A'))
    foo, name = line.split(" A ")
    if(name != nil)
      add_event(:block => 'status', :name => "DNS Queries", :message => "DNS Request: " + name, :update_stats => true, :color => [1.5, 1.0, 0.5, 1.0])
    end
  end 
end