Updated on 2023-12-08 GMT+08:00

Querying Pipeline Logs

Function

Querying Pipeline Logs

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

Project ID.

pipeline_id

Yes

String

Pipeline ID

pipeline_run_id

Yes

String

Pipeline running instance ID

job_run_id

Yes

String

Indicates the pipeline task ID.

step_run_id

Yes

String

Pipeline Step ID

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

start_offset

No

Long

Log Start Offset

end_offset

No

Long

Log End Offset

limit

Yes

Long

Maximum number of log lines

sort

Yes

String

Sorting rule ["asc","desc"]

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

has_more

Boolean

Whether there are more logs

end_offset

String

Indicates the end offset of the query log.

start_offset

String

Start offset of the query log

log

String

Log content

location

String

Log Storage Location

step_run_id

String

Step ID

Example Requests

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: Execute Shell]: This step starts to be executed.\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: execution 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.",
  "location" : "jenkins",
  "step_run_id" : "7a1a7bb1b5e74d1c944d8b8971621033"
}

Status Codes

Status Code

Description

200

Response Body for Querying Logs

Error Codes

See Error Codes.