summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2024-04-17 12:33:36 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2024-04-17 12:33:36 +0200
commitd9d13e4dfb040f6fb11b4cb48b4dbab81b765fd5 (patch)
tree8c38a508ee5f60c94ff5439df87a7160b95e4b5f
parent66c7303fa843c1ba364155c78ca028605f7eb53c (diff)
downloadfuzzer-d9d13e4dfb040f6fb11b4cb48b4dbab81b765fd5.tar.gz
convert error log to csv
-rwxr-xr-xerrors2csv.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/errors2csv.py b/errors2csv.py
new file mode 100755
index 0000000..3f18d0a
--- /dev/null
+++ b/errors2csv.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+import csv
+import shlex
+
+unique_errors = set()
+
+with open('errors.txt', 'r') as f, open('errors.csv', 'w', newline='') as csvfile:
+ fieldnames = ['ERROR', 'MSG', 'STACK', 'STEP', 'ACTIVE', 'STATE', 'ACTION', 'ARGS', 'SETUP', 'DATA', 'DUMP']
+ key_fieldsnames = ['ERROR', 'STATE', 'MSG']
+ writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
+ writer.writeheader()
+
+ for line in f.readlines():
+ line = line.strip()
+ if line.startswith("Loading"):
+ continue
+ # print(line)
+ data = {}
+ for keyval in shlex.split(line):
+ # print(keyval)
+ key, val = keyval.split("=", 2)
+ # print("key", key)
+ # print("val", val)
+ data[key] = val
+ error_key = "_".join([data.get(key, '') for key in key_fieldsnames])
+ if error_key not in unique_errors:
+ unique_errors.add(error_key)
+ writer.writerow(data)