-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscheduler.py
More file actions
42 lines (23 loc) · 758 Bytes
/
scheduler.py
File metadata and controls
42 lines (23 loc) · 758 Bytes
1
2
3
4
5
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
31
32
33
34
35
36
37
# A simple python parser to extract the messages of different logging levels of Apache .
# Author : Prashanth Raghu
# Git Hub Name : prashanthraghu
import sys
errors = {}
errortypes = ["emerg" , "alert" , "crit" , "error" , "warn" , "notice" , "info" , "debug"]
count = 0
for errortype in errortypes:
errors[errortype] = []
for file in sys.argv:
if count == 0:
count = 1
continue;
logfile = open( file , "r" )
# Sort the errors
for log in logfile:
for errortype in errortypes:
if errortype in log:
errors[errortype].append(log)
count = count + 1
# Print them individually , better to write to a Database here !! preferably Sqllite !!
for errortype in errortypes:
print errors[errortype]