haazee

l1.py

Aug 14th, 2014
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import re
  4.  
  5. rex=re.compile('^(.{11})\s(\d\d:\d\d:\d\d)\s(\S+)\s(\w+\.\w+)\s(\w+):\s+(ACCEPT|REJECT|DROP)\s+(.*$)')
  6.  
  7. count=0
  8. n1,n2=0,0
  9. with open('kern.log','r') as log:
  10.  
  11.     for rec in log:
  12.         w=rex.search(rec)
  13.         if w:
  14.             g=w.groups()
  15.             n1+=1
  16.         else:
  17.             n2+=1
  18.     print n1,n2
Advertisement
Add Comment
Please, Sign In to add comment