I have this log file (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
and I want to calculate the statement that was the slowest successful statement for example:
start time - 2018-11-06 16:52:01
End Time - 2018-11-06 16:52:01
the result is zero time and the statement at the end was Success
even though the last statement took 3 seconds it does not matter due to the fact that the statement failed in the end:
Start Time - 2018-11-06 16:52:19
End Time - 2018-11-06 16:52:22
and Failed
so it does not matter.
so it comes that the middle statement took 1 second and was a success so this is the slowest statement.
I wish to implement this code using python that will produce the result.