Getting a task run log for live monitoring
Use the GET method to obtain logs of a task run from the /monitoring/executions/{runId}/logs endpoint.
As a task run log could be huge with its raw formatting, analyzing it could be time-consuming. Therefore, it is recommended to use the approach explained in the previous section for this live monitoring.
Before you begin
-
Generate access tokens:
- For users, generate a personal access token by following Generating a Personal Access Token.
- For service accounts, generate a service access token by following Generating a service account token.
Once generated, a service account token expires after 30 minutes. If it expires, generate a new token using the POST method at the endpoint https://api.<env>.cloud.talend.com/security/oauth/token. For more information about generating a token, see Generating a service account token.
- The user or the service account to be used must have the Author, the Viewer and the Executor permissions for the workspace to which the task to be monitored belongs.
- You must know the ID of the task run you need to monitor.
This ID is available on the Task execution log page, reading as Task execution ID. Or you can obtain this ID via a GET call from the /processing/executables/tasks/{taskId}/executions endpoint.
About this task
In this example, Talend API Tester is used to issue API requests. For further information about Talend API Tester, see Talend Cloud API Tester User Guide.
Procedure
Results
You can then integrate this API call in your own monitoring system to continuously get and analyze the latest information of this run, so that your monitoring system can send notifications accordingly and timely.
{"logTimestamp":1619614861123,"isoDate":"2021-04-28 13:01:01.123","severity":"INFO","logType":null,"logMessage":"messageA1","bundleName":null,"bundleVersion":null}