ListSearchLog
Queries logs of different types for an Elasticsearch instance.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
elasticsearch:ListSearchLogs |
get |
*Instance
|
None | None |
Request syntax
GET /openapi/instances/{InstanceId}/search-log HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID. |
es-cn-n6w1o1x0w001c**** |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| type |
string |
Yes |
The log type. Valid values:
For limits on viewing logs, see Query logs. |
INSTANCELOG |
| query |
string |
Yes |
The keyword to query. |
host:172.16.**.** AND content:netty |
| beginTime |
integer |
No |
The start timestamp of the log, in milliseconds. The value must be within the last 7 days. If this parameter is not specified, all logs within the range of [current time - 7 days, endTime] are queried. |
1531910852074 |
| endTime |
integer |
No |
The end timestamp of the log, in milliseconds. The value must be within the last 7 days. Specify this parameter. If this parameter is not specified, an empty result is returned. |
1531910852074 |
| page |
integer |
No |
The page number of the plugin list. Minimum value: 1. Default value: 1. |
1 |
| size |
integer |
No |
The number of entries per page for a paged query. Default value: 20. Minimum value: 1. Maximum value: 50. |
20 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
7F40EAA1-6F1D-4DD9-8DB8-C5F00C4E**** |
| Headers |
object |
The response headers. |
|
| X-Total-Count |
integer |
The total number of records for the instance. |
1000 |
| Result |
array<object> |
The list of logs returned by the request. |
|
|
array<object> |
|||
| contentCollection |
object |
The log details. Different log types return different content fields. |
{"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 |
string |
The instance ID. |
es-cn-n6w1o1x0w001c**** |
| level |
string |
The log level. Valid values:
The level information has been migrated to the contentCollection field. |
info |
| host |
string |
The IP address of the node that generated the log. |
192.168.**.** |
| content |
string |
The detailed log content. This field has been migrated to the contentCollection field. |
[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] |
| timestamp |
integer |
The timestamp when the log was generated, in milliseconds. |
1531985112420 |
Result.contentCollection contains the following parameters.
| Name | Type | Example | Description |
| time | String | 2020-07-21T11:12:53.057Z | The time when the log was generated. |
| content | String | [o.e.c.r.a.AllocationService] [MnNASM_] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[my_index][3]] ...]). | The detailed log content. |
| host | String | 192.168.**.** | The IP address of the node that generated the log. |
| level | String | warn | The log level. Valid values: warn (warning log), info (information log), error (error log), trace (trace log), and debug (debug log). |
Examples
Success response
JSON format
{
"RequestId": "7F40EAA1-6F1D-4DD9-8DB8-C5F00C4E****",
"Headers": {
"X-Total-Count": 1000
},
"Result": [
{
"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****",
"level": "info",
"host": "192.168.**.**",
"content": "[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] ",
"timestamp": 1531985112420
}
]
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.