ListSearchLog

Updated at:

Queries logs of different types for an Elasticsearch instance.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

elasticsearch:ListSearchLogs

get

*Instance

acs:elasticsearch:{#regionId}:{#accountId}:instances/{#instancesId}

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:

  • INSTANCELOG: primary log.

  • SEARCHSLOW: searching slow log.

  • INDEXINGSLOW: indexing slow log.

  • JVMLOG: GC log.

  • ES_SEARCH_ACCESS_LOG: Elasticsearch access log.

  • AUDIT: audit log.

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:

  • warn: warning log

  • info: information log

  • error: error log

  • trace: trace log

  • debug: debug log

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.

NameTypeExampleDescription
timeString2020-07-21T11:12:53.057ZThe time when the log was generated.
contentString[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.
hostString192.168.**.**The IP address of the node that generated the log.
levelStringwarnThe 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.