Class: MysqlParser
Overview
Parser which handles logs from MySQL
Instance Attribute Summary
Attributes inherited from Parser
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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gl_tail/parsers/mysql.rb', line 9 def parse( line ) # 071013 9:43:17 7 Query select * from users where username='test' limit 10 if line.include? " Query " _, query = /^.* Query\s+(.+)$/.match(line).to_a if query add_activity(:block => 'sites', :name => server.name) add_activity(:block => 'database', :name => query) end elsif line.include? " Connect " # 8 Connect debian-sys-maint@localhost on _, user = /^.* Connect\s+(.+) on\s+/.match(line).to_a if user add_activity(:block => 'logins', :name => "#{user}/mysql" ) end end end |