For this check, we are only interested in the last run of a job. The TX API gives us a number of functions, like:
GET /public/jobs/{job_id}/status: this only gives status none, pending and running. Not failed, errors, warning, ok et cetera….
GET /public/jobs/{job_id}/logs: this one gives status like completed, failed, warning. But it gives the status of al jobs that have run the last weeks. It also shows ‘severity’ as a property, but it's not documented what different severity states mean.
Questions:
How can we filter in job logs, so we only get the last execution with status of the execution (errors, failed, ok, ...) ?
What do different severity states (0,2,..?) mean?
Our main goal is to get the status of the last job exectution.
Thanks!
Page 1 / 1
Hi @rick.hilbrands
I have created a REST data source with the following properties:
Custom Headers (where xyz should be replaced with your API key)
apiKey:xyz
Data Model
FlattenedDocuments
Schema location
Set to folder (e.g. C:\Users\TestUser\Documents\rsd\TXjobs)
Generate Schema Files
OnUse
Once these have been set, right-click on the data source and select Manage Query Tables and add the following query table
SELECT * FROM *REST].[JobExecutionLogs] where JSONData_id= (SELECT TOP(1) _id FROM dREST].[JSONData] order by CreateTime desc)
Then execute the sync and transfer task, which should return data similar to the following for the last run
Furthermore, you can create a second query table which shows the state
SELECT TOP(1) * FROM REST].MJSONData] order by CreateTime desc
The State code represents the following:
State (int)- the state of the execution.
The following states exist:
-1 - none
0 - created
1 - running
2 - completed
3 - failed
4 - completed with errors
5 - completed with warnings
@rick.hilbrands regarding the severity the codes represent the following:
0 - Information 1 - Warning 2 - Error
Hi, thanks for your replies. I managed to solve this using a powershell script to read the webservice (using connector https://apim-txportal-prod.azure-api.net/public/jobs/<jobid>/logs). Based on CREATETIME I've made a filter to only show job executions from last 24 hours. There is one thing I still don't understand. I want to filter only on job executions that have failed. Jobs that have failed do get a STATE=2. But jobs that completed successfully also get a STATE=2. I would expect that failed jobs have STATE=3, so I can filter on STATE=3 to show only failed jobs.
Now I do a full text search on words like ‘error’ and ‘failed’ to determine if the job has completed successfully, but that gives probably not 100% coverage…
Is there another way to determine if a job has failed?