Query Task Log
Query task logs.
GET
https://api.alayanew.com/api/serverless-train/v1/task/{id}/logs
Authorizations
Authorizations:StringHeaderRequired
用户可通过已获取Open API Key做验证,例如:plain Credential=[YOUR_AK],Signature=[YOUR_SK]。
Path Parameters
id:StringRequired
Task ID.
Query Parameters
worker:Int
The worker index, starting from 0.
from:Int
Starting line number, defaults to 1.
tail:Int
Starting from the last N lines, defaults to 1.
size:Int
Number of lines to query, defaults to 100.
Response
状态码:application/json
200
code:Int
code is a common return value format representing the execution result of the query operation.
0
-1
0 is the success identifier, indicating the operation completed successfully.
data:Object
msg:StringRequired
Returns exception information when the code value is -1.
cURL
Python
JavaScript
Go
Java
curl -X GET 'https://api.alayanew.com/api/serverless-train/v1/task/506927a1-1883-4413-abad-0de1ff309023/logs?worker=0&from=10&size=100'
-H 'Authorization: plain Credential=YOUR_AK,Signature=YOUR_SK'
200
400
401
403
404
500
{
"code": 0,
"msg": "success",
"data": {
"lines": [
"2023-10-01 12:00:01 INFO: Service started",
"2023-10-01 12:00:02 DEBUG: Initializing components",
"2023-10-01 12:00:03 INFO: Loading configuration",
"...",
"2023-10-01 12:00:10 INFO: Service ready"
],
"offset": 12345
}
}
tip
如果from和tail都没有指定,日志将从第一行开始打印。