You can call this operation to query a specified type of system logs.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request header

This operation only uses common request headers. For more information, see the Common request parameters topic.

Request syntax

GET /openapi/instances/[InstanceId]/search-log HTTP/1.1

Request parameters

Parameter Type Required Example Description
InstanceId String Yes es-cn-xxx

The ID of the instance.

beginTime Long Yes 1531910852074

The beginning of the time range to query. Unit: milliseconds.

endTime Long Yes 1531910852074

The end of the time range to query. Unit: milliseconds.

page Integer Yes 1

The number of the page to return. Minimum value: 1. Default value: 1.

query String Yes abc

The keyword used to match log entries.

size Integer Yes 20

The number of entries to return on each page.

type String Yes INSTANCELOG

The type of the logs. Valid values: INSTANCELOG (instance log), SEARCHSLOW (search slow log), INDEXINGSLOW (indexing slow log), and JMVLOG (GC log).

Response parameters

Parameter Type Example Description
Headers

The header of the response.

X-Total-Count Integer 1000

The number of entries returned per page.

RequestId String 7F40EAA1-6F1D-4DD9-8DB8-C5F00C4E****

The ID of the request.

Result Array

The returned log entries.

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]

The content of the log entry.

host String 192.168.**. **

The IP address of the node from which the log entry was collected.

instanceId String es-cn-abc

The ID of the Elasticsearch instance.

level String info

The level of the log entry. Valid values: warn, info, error, and trace.

timestamp Long 1531985112420

The time when the log entry was collected. Unit: milliseconds.

Examples

Sample requests

GET /openapi/instances/es-cn-abc/search-logpage=1&size=20&type=INDEXINGSLOW&beginTime=1552793133000&endTime=1552879533000&query=content:green

Sample success responses

XML format

<Result>
    <timestamp>1552868172741</timestamp>
    <host>192.168. **.**</host>
    <contentCollection>
        <level>info</level>
        <host>192.168. **.**</host>
        <time>2019-03-18T08:16:12.741Z</time>
        <content>[o.e.c.r.a.AllocationService] [MnNASM_] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[my_index][3]] ...]).</content>
    </contentCollection>
    <instanceId>es-cn-xxx</instanceId>
</Result>
<Result>
    <timestamp>1552838205462</timestamp>
    <host>192.168. **.**</host>
    <contentCollection>
        <level>info</level>
        <host>192.168. **.**</host>
        <time>2019-03-17T23:56:45.462Z</time>
        <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]).</content>
    </contentCollection>
    <instanceId>es-cn-xxx</instanceId>
</Result>
<RequestId>121753D9-744A-4203-9EC4-F29E628A****</RequestId>
<Headers>
    <X-Total-Count>2</X-Total-Count>
</Headers>

JSON format

{
	"Headers":{
		"X-Total-Count":2
	},
	"Result":[
		{
			"timestamp":1552868172741,
			"host":"192.168. **.**",
			"instanceId":"es-cn-xxx",
			"contentCollection":{
				"content":"[o.e.c.r.a.AllocationService] [MnNASM_] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[my_index][3]] ...]).",
				"time":"2019-03-18T08:16:12.741Z",
				"host":"192.168. **.**",
				"level":"info"
			}
		},
		{
			"timestamp":1552838205462,
			"host":"192.168. **.**",
			"instanceId":"es-cn-xxx",
			"contentCollection":{
				"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]).",
				"time":"2019-03-17T23:56:45.462Z",
				"host":"192.168. **.**",
				"level":"info"
			}
		}
	],
	"RequestId":"121753D9-744A-4203-9EC4-F29E628A****"
}

Error codes

For a list of error codes, visit the API Error Center.