My requirement is to group events (list of jobs) based on their status.
The status value starts with RUNNING and may end with SUCCESS OR FAILURE.
I want make a table which shows the list of jobs along with the start time, end time, and current status (whether RUNNING, SUCCESS, OR FAILURE)
My table should display RUNNING status until the job ends up with SUCCESS or FAILURE.
In case any one of the jobs is FAILED, the status should be FAILURE. Once the issue is fixed and the same job is status=SUCCESS, I want my table to display SUCCESS. It should be a single entry for the job. Not separate entry for the failed one and the success one.
I have tried two methods as mentioned below, but I'm finding a defect in both of the methods.
Method 1:
index=XXX sourcetype=yyy autosys_job=* autosys_status=* | transaction autosys_job keepevicted=true startswith=RUNNING endswith=eval((match autosys_status, "SUCCESS") OR (match autosys_status, "FAILURE")) |eval starttime=_time | eval endtime=_time+duration | stats last(autosys_status) AS CurrentStatus by autosys_job starttime endtime
The issue I am facing with this method is in case of any job getting failed and then running to success after sometime. There are separate entries displayed for the FAILED and SUCCESS, but I don't want to display the failed entry once it is run to success.
Method 2:
index=XXX sourcetype=yyy autosys_job=* autosys_status=* | stats latest(autosys_status) AS currentstatus, earliest(_time) AS Starttime, latest(_time) AS Endtime by autosys_job
Issue I have an issue with this method when the cause is failing.
i.e. one job starts running then fails and after some time it is running to success. Here start time in the query takes initial start time (failed one) and endtime in the query takes the latest time from success one. But I want to display the start time and end time for the success run.
Please let me know how can I resolve this one.
... View more