查询特定日志条目周围的日志 | 大装置帮助中心
跳到主要内容

查询特定日志条目周围的日志

接口描述

POST

/monitor/ts/data/v1/subscriptions/:subscription_name/resourceGroups/:resource_group_name/zones/:zone/telemetryStations/:telemetry_station_name/logStream/products/:product_name/logSurround

查询特定日志条目周围的日志

请求头(Request Header)

参考认证(authentication)

请求参数(Request Parameters)

名称类型必须位置默认值取值范围描述
subscription_namestringpath--订阅
resource_group_namestringpath--资源组
zonestringpath--可用区
telemetry_station_namestringpath--监控空间
product_namestringpath--产品名

请求体(Request Body)

名称类型描述
log_idstring日志id
newerint最新条目数
olderint历史条目数
resource_id[]string资源id
custom_filter[]CustomFilters自定义筛选(如任务名称、容器名称筛选)
filterstring筛选内容
option_filtersOperationFilters操作日志下查询参数
orderstring排序,ACS:正序;DESC:倒序
severity_text[]string告警日志等级:INFO;DEBUG;WARN;ERROR;FATAL

其中CustomFilters 如下:

名称类型描述
keystring自定义查询的键
valuestring自定义查询的值,可以是中文或自定义值

其中 OperationFilters 如下:

名称类型描述
keystring操作日志查询的键
valuestring操作日志查询的值,中文;或传入操作日志查询的值

请求示例(Request Example)

curl -XPOST 'https://monitor.sensecoreapi.tech/monitor/ts/data/v1/subscriptions/224bae0c-a98f-41f5-b5d3-9f54aa98455f/resourceGroups/default/zones/cn-sh-01z/telemetryStations/ts-user-a95a77a3-961f-43fa-9577-d5c8a2cb0149/logStream/products/product.lepton-acp-new/logSurround' \
-H 'Content-Type: application/json' \
-d '
{
"resource_id": [
"b62544d6-b060-11ee-9812-f26b14e33415"
],
"custom_filter": [
{
"key": "Attributes.k8s.job.name",
"value": "tf-e06cu52h"
},
{
"key": "Attributes.k8s.job.name",
"value": "pt-ztw5gyuw"
},
{
"key": "Attributes.k8s.job.name",
"value": "pt-zt4ldj8a"
}
],
"severity_text": [
"TRACE",
"DEBUG",
"INFO",
"WARN",
"ERROR",
"FATAL"
],
"log_id": "9147VY0BFLfb0IqQL09Y",
"newer": 50,
"older": 50
}
'

响应(Response)

名称类型描述
totalstring日志总条数
hits[]SurroundHits日志内容

其中SurroundHits如下:

名称类型描述
idstring标识符
log_timestring时间戳
severity_textstring严重程度文本
severity_numberstring严重程度数字
bodystring主体
resourceResource资源
attributesmap属性

其中,Resource如下:

名称类型描述
namestring资源的名称
native_idstring资源的本地标识符
resource_idstring资源id
resource_typestring资源类型

响应示例(Response Example)

{
"total": "56",
"hits": [
{
"id": "0FczVY0BFLfb0IqQ3vOH",
"log_time": "2024-01-29T12:30:50.473706848Z",
"severity_text": "INFO",
"severity_number": "9",
"body": " iteration 15/ 1000 | consumed samples: 3840 | consumed tokens: 7864320 | elapsed time per iteration (ms): 19054.8 | learning rate: 9.996E-07 | global batch size: 256 | lm loss: 6.807280E+00 | loss scale: 4096.0 | grad norm: 33.561 | actual seqlen: 2048 | number of skipped iterations: 0 | number of nan iterations: 0 | samples per second: 13.435 | TFLOPs: 139.75 |",
"resource": {
"name": "",
"native_id": "",
"resource_id": "b62544d6-b060-11ee-9812-f26b14e33415",
"resource_type": ""
},
"attributes": {
"application.instance.id": "pt-zt4ldj8a",
"application.name": "sensecore.lepton-acp-new.job",
"k8s.container.name": "pytorch",
"k8s.job.name": "pt-zt4ldj8a",
"k8s.pod.name": "pt-zt4ldj8a-worker-0"
}
},
{
"id": "-_kzVY0BWFtKIC8b4_Tw",
"log_time": "2024-01-29T12:30:50.473798908Z",
"severity_text": "INFO",
"severity_number": "9",
"body": "time (ms)",
"resource": {
"name": "",
"native_id": "",
"resource_id": "b62544d6-b060-11ee-9812-f26b14e33415",
"resource_type": ""
},
"attributes": {
"application.instance.id": "pt-zt4ldj8a",
"application.name": "sensecore.lepton-acp-new.job",
"k8s.container.name": "pytorch",
"k8s.job.name": "pt-zt4ldj8a",
"k8s.pod.name": "pt-zt4ldj8a-worker-0"
}
},
{
"id": "3lg0VY0BFLfb0IqQY3ed",
"log_time": "2024-01-29T12:31:09.474515862Z",
"severity_text": "INFO",
"severity_number": "9",
"body": " iteration 16/ 1000 | consumed samples: 4096 | consumed tokens: 8388608 | elapsed time per iteration (ms): 19065.0 | learning rate: 9.995E-07 | global batch size: 256 | lm loss: 6.564068E+00 | loss scale: 4096.0 | grad norm: 24.916 | actual seqlen: 2048 | number of skipped iterations: 0 | number of nan iterations: 0 | samples per second: 13.428 | TFLOPs: 139.68 |",
"resource": {
"name": "",
"native_id": "",
"resource_id": "b62544d6-b060-11ee-9812-f26b14e33415",
"resource_type": ""
},
"attributes": {
"application.instance.id": "pt-zt4ldj8a",
"application.name": "sensecore.lepton-acp-new.job",
"k8s.container.name": "pytorch",
"k8s.job.name": "pt-zt4ldj8a",
"k8s.pod.name": "pt-zt4ldj8a-worker-0"
}
}
]
}