调用ListSearchLog,查看实例日志。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求头
该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。
请求语法
GET /openapi/instances/{InstanceId}/search-log HTTP/1.1
请求参数
名称 | 类型 | 位置 | 是否必选 | 示例值 | 描述 |
---|
名称 | 类型 | 位置 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|---|
InstanceId | String | Path | 是 | es-cn-n6w1o1x0w001c**** |
实例ID。 |
type | String | Query | 是 | INSTANCELOG |
日志类型。可选值:
查看日志的相关限制信息,请参见查询日志。 |
query | String | Query | 是 | host:172.16.**.** AND content:netty |
要查询的关键词。 |
beginTime | Long | Query | 否 | 1531910852074 |
日志开始时间戳,单位:毫秒。必须为最近7天内的时间,如果不填会查询[当前时间-7天,endTime]范围内的所有日志。 |
endTime | Long | Query | 否 | 1531910852074 |
日志结束时间戳,单位:毫秒。必须为最近7天内的时间,建议填写,如果不填返回结果为空。 |
page | Integer | Query | 否 | 1 |
插件列表的页码。起始值:1,默认值:1。 |
size | Integer | Query | 否 | 20 |
分页查询时设置的每页条数。默认值:20,最小值:1,最大值:50。 |
返回数据
Result.contentCollection中包含以下参数。
名称 |
类型 |
示例值 |
描述 |
---|
名称 |
类型 |
示例值 |
描述 |
---|---|---|---|
time |
String |
2020-07-21T11:12:53.057Z |
日志产生的时间。 |
content |
String |
[o.e.c.r.a.AllocationService] [MnNASM_] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[my_index][3]] ...]). |
日志详细内容。 |
host |
String |
192.168.. |
生成日志的节点IP。 |
level |
String |
warn |
日志等级。取值包括: warn(警告日志)、info(信息日志)、error(错误日志)、trace(跟踪日志)、debug(调试日志)。 |
示例
请求示例
GET /openapi/instances/es-cn-n6w1o1x0w001c****/search-log?type=INSTANCELOG&query=host:172.16.**.** AND content:netty&beginTime=1531910852074&endTime=1531910852074&page=1&size=20 HTTP/1.1
Host:elasticsearch.aliyuncs.com
Content-Type:application/json
正常返回示例
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"Result" : [ {
"timestamp" : 1552868172741,
"host" : "192.168.**.**",
"contentCollection" : {
"level" : "info",
"host" : "192.168.**.**",
"time" : "2019-03-18T08:16:12.741Z",
"content" : "[o.e.c.r.a.AllocationService] [MnNASM_] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[my_index][3]] ...])."
},
"instanceId" : "es-cn-n6w1o1x0w001c****"
}, {
"timestamp" : 1552838205462,
"host" : "192.168.**.**",
"contentCollection" : {
"level" : "info",
"host" : "192.168.**.**",
"time" : "2019-03-17T23:56:45.462Z",
"content" : "[o.e.c.r.a.AllocationService] [v4p9o7A] Cluster health status changed from [GREEN] to [YELLOW] (reason: [{MnNASM_}{MnNASM_OSR-2YgySSc****}{EvJHPrAOS_u8J3-6qZ****}{192.168.**.**}{192.168.**.**:9300}{ml.max_open_jobs=10, ml.enabled=true} transport disconnected])."
},
"instanceId" : "es-cn-n6w1o1x0w001c****"
} ],
"RequestId" : "121753D9-744A-4203-9EC4-F29E628A****",
"Headers" : {
"X-Total-Count" : 2
}
}
错误码
访问错误中心查看更多错误码。