我有这个日志文件(log.txt):
omer| (stmt : 0) | adminT| Connection id - 0
omer| (stmt : 0) | adminT| Start Time - 2018-11-06 16:52:01
omer| (stmt : 0) | adminT| Statement create or replace table amit (x date);
omer| (stmt : 0)| adminT| Connection id - 0 - Executing - create or replace table amit (x date);
omer| (stmt : 0) | adminT| Connection id - 0
omer| (stmt : 0) | adminT| End Time - 2018-11-06 16:52:01
omer| (stmt : 0) | adminT| SQL - create or replace table amit (x date);
omer| (stmt : 0) | adminT| Success
admin| (stmt : 1) | adminT| Connection id - 0
admin| (stmt : 1) | adminT| Start Time - 2018-11-06 16:52:14
admin| (stmt : 1) | adminT| Statement create or replace table amit (x int, y int);
admin| (stmt : 1)| adminT| Connection id - 0 - Executing - create or replace table amit (x int, y int);
admin| (stmt : 1) | adminT| Connection id - 0
admin| (stmt : 1) | adminT| End Time - 2018-11-06 16:52:15
admin| (stmt : 2) | adminT| Connection id - 0
admin| (stmt : 2) | adminT| Start Time - 2018-11-06 16:52:19
admin| (stmt : 2) | adminT| Statement create table amit (x int, y int);
admin| (stmt : 2) | adminT| Connection id - 0
admin| (stmt : 2) | adminT| End Time - 2018-11-06 16:52:22
admin| (stmt : 2) | adminT| SQL - Can't create table 'public.amit' - a table with the same name already exists
admin| (stmt : 2) | adminT| Failed
我想计算最慢的成功语句,例如:
start time - 2018-11-06 16:52:01
End Time - 2018-11-06 16:52:01
结果是零时间,最后的语句是Success
即使最后一条语句花费了 3 秒,也没有关系,因为该语句最终失败了:
Start Time - 2018-11-06 16:52:19
End Time - 2018-11-06 16:52:22
所以Failed
没关系。所以中间语句花了 1 秒并且是成功的,所以这是最慢的语句。
我希望使用 python 来实现这个代码,它会产生结果。