Better log analysis

This commit is contained in:
Quentin 2020-01-20 20:20:12 +01:00
parent e0f19baf69
commit 2ed3b94e24
1 changed files with 4 additions and 3 deletions

7
scripts/understand_tor.py Normal file → Executable file
View File

@ -9,7 +9,8 @@ input()
with open('better_logs.txt', 'w') as f:
for line in sys.stdin:
r = re.search(r'650 CIRC (\d+) (\S+) \S+ BUILD_FLAGS=\S+ PURPOSE=(\S+) HS_STATE=(\S+) TIME_CREATED=(\S+) (REASON=(\S+))?
', line)
r = re.search(r'650 CIRC (\d+) (\S+) (\S+) BUILD_FLAGS=(\S+) PURPOSE=(\S+) HS_STATE=(\S+)( REND_QUERY=(\S+))? TIME_CREATED=(\S+)( REASON=(\S+))?', line)
if not r: continue
f.write("\n")
circ_id, circ_status, circ_relay_list, build_flags, purpose, hs_state, _, rend_query, time_created, _, reason= r.groups()
f.write(f"{circ_id},{circ_status},{purpose},{hs_state},{rend_query},{reason}\n")
f.flush()