Queries the logs of a Logstash cluster.

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 headers

This operation uses only common request headers. For more information, refer to the documentation of common request parameters.

Request syntax

GET /openapi/logstashes/{InstanceId}/search-log HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
InstanceId String Path Yes ls-cn-v0h1kzca****

The ID of the instance.

type String Query Yes LOGSTASH_INSTANCE_LOG

The type of the log. Valid values:

  • LOGSTASH_INSTANCE_LOG: master logs
  • SEARCHSLOW: searching slow logs
  • INDEXINGSLOW: indexing slow logs
  • JVMLOG: GC logs
  • LOGSTASH_DEBUG_LOG: debug logs
query String Query Yes host:10.7.xx.xx AND level:info AND content:opening

The keyword used to match log entries.

beginTime Long Query No 1531910852074

The timestamp of the log start. Unit: ms.

endTime Long Query No 1531910852074

The timestamp of the end of the log. Unit: ms.

page Integer Query No 1

The page number of the returned page. Default value: 1, minimum value: 1, maximum value: 200.

size Integer Query No 20

The number of entries to return on each page. Default value: 20, minimum value: 1, maximum value: 100.

Response parameters

Parameter Type Example Description
RequestId String 7F40EAA1-6F1D-4DD9-8DB8-C5F00C4E****

The ID of the request.

Result Array of Result

The returned data.

level String info

The severity level of the log entry. Including trace, debug, info, warn, error, etc. (GC logs have no level).

content String [logstash.outputs.fileextend] Opening file {:path=>\"/ssd/1/ls-cn-v0h1kzca****/logstash/logs/debug/test\"}

The details of the log.

timestamp Long 1531985112420

The timestamp of log generation. Unit: ms.

instanceId String ls-cn-v0h1kzca****

The ID of the instance.

host String 192.168.xx.xx

The IP address of the node that generates the log.

The following parameters are also included in the returned data.

Parameter

Type

Example

Description

Result

Struct

The returned data.

└time

String

2020-07-22T16:58:00.506Z

The time when the log entry was generated.

Headers

Struct

The header of the response.

└X-Total-Count

Integer

1

The number of returned logs.

Note └ indicates a child parameter.

Examples

Sample requests

GET /openapi/logstashes/ls-cn-v0h1kzca****/search-log?type=LOGSTASH_INSTANCE_LOG&query=host:10.7.xx.xx AND level:info AND content:opening&beginTime=1531910852074&endTime=1531910852074&page=1&size=20 HTTP/1.1
Host:elasticsearch.aliyuncs.com
Content-Type:application/json

Sample success responses

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Result" : [ {
    "timestamp" : 1595408280506,
    "host" : "10.7.**.**",
    "contentCollection" : {
      "level" : "info",
      "host" : "10.7.**.**",
      "time" : "2020-07-22T16:58:00.506Z",
      "content" : "[logstash.outputs.fileextend] Opening file {:path=>\"/ssd/1/ls-cn-v0h1kzca****/logstash/logs/debug/test\"}"
    },
    "instanceId" : "ls-cn-v0h1kzca****"
  } ],
  "RequestId" : "DADBEFD2-570D-48EE-ABE4-0E3017D8****",
  "Headers" : {
    "X-Total-Count" : 1
  }
}

Error code

HttpCode Error code Error message Description
400 InstanceActivating Instance is activating. The instance is currently in effect.
400 InstanceNotFound The instanceId provided does not exist. The instance cannot be found. Please check the instance status.

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