Updated on 2026-01-12 GMT+08:00

Querying Pipeline Logs

Function

This API is used to query pipeline logs.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{project_id}/api/pipelines/{pipeline_id}/pipeline-runs/{pipeline_run_id}/jobs/{job_run_id}/steps/{step_run_id}/logs

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details, see Obtaining a Project ID.

Constraints:

N/A

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

pipeline_id

Yes

String

Definition:

Pipeline ID. Obtain the ID by calling the API for querying pipelines. pipelines.pipelineId indicates the pipeline ID.

Constraints:

N/A

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

pipeline_run_id

Yes

String

Definition:

Pipeline run ID. The return value of the API for starting a pipeline is the pipeline run ID.

Constraints:

N/A

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

job_run_id

Yes

String

Parameter description:

Pipeline job ID.

Constraints:

N/A.

Value range:

32 characters, including only digits and letters.

Default value:

N/A.

step_run_id

Yes

String

Parameter description:

Pipeline step ID.

Constraints:

N/A.

Value range:

32 characters, including only digits and letters.

Default value:

N/A.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

User token. Obtain a token (the value of the X-Subject-Token response header) by calling the IAM API for .

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

start_offset

No

Long

Parameter description:

Log start offset.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

end_offset

No

Long

Parameter description:

Log end offset.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

limit

Yes

Long

Parameter description:

Maximum number of log lines.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

sort

Yes

String

Definition:

Sorting rule.

Constraints:

N/A

Value range:

  • asc: by sorting field in ascending order.

  • desc: by sorting field in descending order.

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

has_more

Boolean

Definition:

Whether there are more logs.

Value range:

  • true: There are more logs.

  • false: There are no more logs.

end_offset

String

Parameter description:

End offset of the log query. Enter the end_offset field in the request body to query logs on the next page.

Value range:

N/A.

start_offset

String

Parameter description:

Start offset of the queried logs. Enter the start_offset field in the request body to query logs on the next page.

Value range:

N/A.

log

String

Parameter description:

Log content.

Value range:

N/A.

step_run_id

String

Parameter description:

ID of the step to which it belongs.

Value range:

N/A.

Example Requests

POST https://{endpoint}/v5/d80a8a6530324b7bac972cbb8a9f28ec/pipelines/e2bcbd561fbc4fd89577fb27c80b09a6/pipeline-runs/9e91b1fd7ce743b7a1b7a2458bcf76c7/jobs/6ce8600f396c4d5ba5290201ba9fd762/steps/7a1a7bb1b5e74d1c944d8b8971621033/logs

{
  "start_offset" : 0,
  "end_offset" : 0,
  "limit" : 500,
  "sort" : "asc"
}

Example Responses

Status code: 200

Response body for querying logs.

{
  "has_more" : false,
  "end_offset" : "25705",
  "start_offset" : "6132",
  "log" : "[2023/11/24 21:49:32.198 GMT+08:00] [INFO] [real_stage: Shell]: This step starts.\n[2023/11/24 21:49:32.201 GMT+08:00] [INFO] [real_stage: Shell]: ================== start to do VmExecutionStep ==================\n[2023/11/24 21:49:32.207 GMT+08:00] [INFO] [real_stage: Shell]: [frame] start to send status data to service.\n[2023/11/24 21:49:32.225 GMT+08:00] [INFO] [real_stage: Shell]: [frame] finish to save status data to service.\n[2023/11/24 21:49:32.777 GMT+08:00] [INFO] [real_stage: Shell]: slave arch: amd64\n[2023/11/24 21:49:33.330 GMT+08:00] [INFO] [real_stage: Shell]: download file result: SUCCESS\n[2023/11/24 21:49:36.547 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== flow agent launched in [octopus_container] ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== use env job loader ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] start to do status callback\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] successfully callback to flow service\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] step begin: [1/1]- [Execute Shell]\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] start to use official executor [official_shell_plugin]\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] ###############################@@@ [step start] @@@###############################\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== start to use script executor ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== start to execute shell pre function [make temp dir] ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== shell pre function [make temp dir] current temp dir:[/data/workspace/6ce8600f396c4d5ba5290201ba9fd762/7a1a7bb1b5e74d1c944d8b8971621033] ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== end to execute shell pre function [make temp dir] successfully ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== start to execute custom shell ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] 1\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== finish to use script executor with status success ===========\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] ################################@@@ [step end] @@@################################\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] finish to use official executor\nThe [2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] step executes Shell succeed.\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] start to do data callback with context:[{1eaa92ecea2a42cab78e5269963a48c1 6ce8600f396c4d5ba5290201ba9fd762 7a1a7bb1b5e74d1c944d8b8971621033      0}]\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] successfully callback to flow service\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] current step, duration time: [0.030766842]\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] start to do status callback\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] successfully callback to flow service\n[2023/11/24 21:49:36.548 GMT+08:00] [2023-11-24 21:49:36] [INFO] =========== flow agent end ===========\n[2023/11/24 21:49:36.563 GMT+08:00] [INFO] [real_stage: Shell]: [frame] start to send status data to service.\n[2023/11/24 21:49:36.563 GMT+08:00] [INFO] [real_stage: Shell]: This step is complete.",
  "step_run_id" : "7a1a7bb1b5e74d1c944d8b8971621033"
}

Status Codes

Status Code

Description

200

Response body for querying logs.

Error Codes

See Error Codes.