查询特定日志条目周围的日志
接口描述
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)
请求参数(Request Parameters)
名称 | 类型 | 必须 | 位置 | 默认值 | 取值范围 | 描述 |
---|---|---|---|---|---|---|
subscription_name | string | 是 | path | - | - | 订阅 |
resource_group_name | string | 是 | path | - | - | 资源组 |
zone | string | 是 | path | - | - | 可用区 |
telemetry_station_name | string | 是 | path | - | - | 监控空间 |
product_name | string | 是 | path | - | - | 产品名 |
请求体(Request Body)
名称 | 类型 | 描述 |
---|---|---|
log_id | string | 日志id |
newer | int | 最新条目数 |
older | int | 历史条目数 |
resource_id | []string | 资源id |
custom_filter | []CustomFilters | 自定义筛选(如任务名称、容器名称筛选) |
filter | string | 筛选内容 |
option_filters | OperationFilters | 操作日志下查询参数 |
order | string | 排序,ACS:正序;DESC:倒序 |
severity_text | []string | 告警日志等级:INFO;DEBUG;WARN;ERROR;FATAL |
其中CustomFilters
如下:
名称 | 类型 | 描述 |
---|---|---|
key | string | 自定义查询的键 |
value | string | 自定义查询的值,可以是中文或自定义值 |
其中 OperationFilters
如下:
名称 | 类型 | 描述 |
---|---|---|
key | string | 操作日志查询的键 |
value | string | 操作日志查询的值,中文;或传入操作日志查询的值 |
请求示例(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)
名称 | 类型 | 描述 |
---|---|---|
total | string | 日志总条数 |
hits | []SurroundHits | 日志内容 |
其中SurroundHits
如下:
名称 | 类型 | 描述 |
---|---|---|
id | string | 标识符 |
log_time | string | 时间戳 |
severity_text | string | 严重程度文本 |
severity_number | string | 严重程度数字 |
body | string | 主体 |
resource | Resource | 资源 |
attributes | map | 属性 |
其中,Resource
如下:
名称 | 类型 | 描述 |
---|---|---|
name | string | 资源的名称 |
native_id | string | 资源的本地标识符 |
resource_id | string | 资源id |
resource_type | string | 资源类型 |
响应示例(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"
}
}
]
}