Skip to content
Snippets Groups Projects
Commit 8a44f92a authored by 42loop's avatar 42loop
Browse files

moved some bad logs to 'bad' directory

parent 843e8b22
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python3
import re
from datetime import datetime
import glob
all_logs=glob.glob("*.log.txt")
for fname in all_logs:
startfound=False
print(fname)
for i, line in enumerate(open(fname)):
#print(i,line)
ts=re.findall(r"^\[\w+.",line)
try:
ts2=int(ts[0][1:-1])
#print("ts2:",ts2)
if (ts2>1580997600) and not startfound:
startfound=True
dt_object = datetime.fromtimestamp(ts2)
print("first: ",i,dt_object)
except:
print("error:",i,line)
ts=re.findall(r"^\[\w+.",line)
ts2=int(ts[0][1:-1])
dt_object = datetime.fromtimestamp(ts2)
print("last: ",i,dt_object)
print("___________________________________________________________")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment