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 Monitoring task runs by accessing only relevant logs to directly identify the runs that raise issues.

Before you begin

  • Generate an access token:
    • For users, generate a personal access token. For further information, see Generating a Personal Access Token.
    • For service accounts, generate a service account token. For further information about how to generate a service account token, see 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.

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

  1. Open Talend API Tester in your browser and select GET from the Method list.

  2. In the field next to the Method drop-down list, enter the endpoint to be used: https://api.<your_environment>.cloud.talend.com/monitoring/executions/<runId>/logs

    Get customer logs

  3. In the HEADERS area, click Add header and in the name field that is displayed, enter Authorization and in the value field, enter Bearer and your personal access token or service account token. Enter a whitespace to separate Bearer and the token.

  4. Click Send to issue your request.

  5. Click the Save button to save this request in your repository on Talend API Tester.

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.

The following example presents an entry in the logs:

{"logTimestamp":1619614861123,"isoDate":"2021-04-28 13:01:01.123","severity":"INFO","logType":null,"logMessage":"messageA1","bundleName":null,"bundleVersion":null}

Note that the isoDate field appears only in the logs of the tasks running on an engine v2.11.11 and onwards.