Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import re
- rex=re.compile('^(.{11})\s(\d\d:\d\d:\d\d)\s(\S+)\s(\w+\.\w+)\s(\w+):\s+(ACCEPT|REJECT|DROP)\s+(.*$)')
- count=0
- n1,n2=0,0
- with open('kern.log','r') as log:
- for rec in log:
- w=rex.search(rec)
- if w:
- g=w.groups()
- n1+=1
- else:
- n2+=1
- print n1,n2
Advertisement
Add Comment
Please, Sign In to add comment