調用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。 |
返回資料
| 名稱 | 類型 | 樣本值 | 描述 |
| RequestId | String | 7F40EAA1-6F1D-4DD9-8DB8-C5F00C4E**** | 請求ID。 |
| Headers | Object | 返回頭資訊。 |
|
| X-Total-Count | Integer | 1000 | 執行個體總記錄數。 |
| Result | Array of Result | 請求返回的日誌列表。 |
|
| level | String | info | 日誌等級。取值包括:
level資訊已遷移至contentCollection欄位中。 |
| host | String | 192.168.**.** | 組建記錄檔的節點的IP地址。 |
| content | String | [GC (Allocation Failure) 2018-07-19T17:24:20.682+0800: 7516.513: [ParNew: 6604768K->81121K(7341504K), 0.0760606 secs] 7226662K->703015K(31813056K), 0.0762507 secs] [Times: user=0.52 sys=0.00, real=0.07 secs] | 日誌詳細內容。已遷移至contentCollection欄位中。 |
| timestamp | Long | 1531985112420 | 日誌產生的時間戳記,單位為ms。 |
| contentCollection | Map | 日誌詳細資料。不同的日誌類型,返回不同的內容欄位。 |
|
| instanceId | String | es-cn-n6w1o1x0w001c**** | 執行個體ID。 |
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
}
}
錯誤碼
訪問錯誤中心查看更多錯誤碼。