Query logs of a subtask instance

2023-08-15 11:21:17  Updated

Description

You can call this operation to query subtask execution logs based on the ID of the subtask instance. A running subtask must be queried multiple times and the logs are automatically updated each time when the subtask is queried.

Call description

Prerequisite

You have the TASK_VIEWER permissions.

Request path

GET /api/v2/tasks/instances/{taskInstanceId}/subtasks/{subtaskInstanceId}/log

Request parameters

Parameter Type Required Example value Description
taskInstanceId Long Yes 1000 The ID of the task instance.
subtaskInstanceId Long Yes 10001 The ID of the subtask instance.

Response parameters

Parameter Type Description
data Object The requested data.
├─ log String The log information. Multiple lines of logs are separated with \n.
successful Boolean Indicates whether the request was successful.
timestamp Datetime The timestamp when the server completed the request.
duration Integer The time taken by the server to process the request, in milliseconds.
status Integer An HTTP status code.
traceId String The trace ID of the request. This trace ID is used for troubleshooting.
server String The address of the application server that responded to the request.

Examples

Sample request

GET /api/v2/tasks/instances/100/subtasks/1000/log

Sample response

{
  "data": {
    "log": "############{EXECUTE}{2021-08-25T15:09:32.697+08:00}############\n2021-08-25 15:09:32.716  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.c.m.t.model.SubtaskInstanceEntity  : Run subtask, id=13000335, context=Context(parallelIdx=-1, stringMap={prohibit_rollback=false, is_reinstall_host_agent=true, ocp_agent_install_version=3.1.2-20210812221645, task_instance_id=35000312, task_operation=execute, latest_execution_start_time=2021-08-25T15:09:32.688+08:00, ocp_agent_origin_version=3.1.2-20210812221645, sub_task_instance_id=13000335, host_id=3000002}, listMap={}), executor=192.168.0.1\n\n2021-08-25 15:09:32.726  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] a.o.s.t.b.h.PrepareReinstallOcpAgentTask : [PrepareReinstallOcpAgentTask] begin\n\n2021-08-25 15:09:32.755  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.service.compute.host.HostService   : Updated host status: host [3000002:100.81.152.105], from status [ONLINE] to [OFFLINE]\n\n2021-08-25 15:09:32.772  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.compute.agent.HostAgentService   : Checking and updating OCP agent status for OCP agent reinstallation: hostId=3000002\n\n2021-08-25 15:09:32.776  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.compute.agent.HostAgentService   : Checking OCP agent status for OCP agent reinstallation: hostId=3000002\n\n2021-08-25 15:09:32.791  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.compute.agent.HostAgentService   : Finding OCP agent: hostId=3000002\n\n2021-08-25 15:09:32.796  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.c.p.HostAgentProcessService      : Getting all OCP agent processes on host 3000002\n\n2021-08-25 15:09:32.911  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.compute.agent.HostAgentService   : Finding OCP agent: hostId=3000002\n\n2021-08-25 15:09:32.916  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.c.p.HostAgentProcessService      : Getting all OCP agent processes on host 3000002\n\n2021-08-25 15:09:32.945  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.compute.agent.HostAgentService   : Updating OCP agent status, hostId=3000002, status=REINSTALLING\n\n2021-08-25 15:09:32.951  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.s.compute.agent.HostAgentService   : Updated agent 5000003 status REINSTALLING \n\n2021-08-25 15:09:33.064  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] a.o.s.t.b.h.PrepareReinstallOcpAgentTask : [PrepareReinstallOcpAgentTask] end\n\n2021-08-25 15:09:33.073  INFO 57200 --- [pool-subtask-executor-thread-32,8ae3dcf2e4374658,d286cf9d6de4] c.a.o.c.m.t.model.SubtaskInstanceEntity  : Set state for subtask: 13000335, current state: RUNNING, new state: SUCCESSFUL\n"
  },
  "duration": 17,
  "server": "192.168.0.1",
  "status": 200,
  "successful": true,
  "timestamp": "2021-08-25T15:10:13.351+08:00",
  "traceId": "5443013f6a1c4cfd"
}

Contact Us