Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update csv_to_html.py #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def error_csv():
errors[val] = 1
else:
errors[val] = errors.get(val)+1
sorted_errors = collections.orderedDict(sorted(errors.items(), key=operator.itemgetter(1), reverse=True))
sorted_errors = collections.OrderedDict(sorted(errors.items(), key=operator.itemgetter(1), reverse=True))
with open("error_message.csv", "w") as f:
writer = csv.DictWriter(f, fieldnames=["Error", "Count"])
writer.writeheader()
Expand All @@ -33,7 +33,7 @@ def user_csv():
with open("syslog.log", "r") as file:
for line in file.readlines():
val=line[line.find("(")+1:line.find(")")]
if val not in userdata:
if val not in userData:
userData[val] = [0]*2
if line.find("ERROR"):
errVal = userData.get(val)[1]+1
Expand All @@ -45,4 +45,4 @@ def user_csv():
[f.write("{0}, {1}\n".format(key,value)) for key,value in sorted_userData.items()]
return sorted_userData

print(user_csv())
print(user_csv())