ListLogs
Retrieves logs for the specified OpenSearch cluster. For detailed description, see the Logs section in the developer's guide.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListClusterLogsRequest =
cloudApi.mdb.clickhouse_cluster_service.ListClusterLogsRequest;
const ListClusterLogsRequest_ServiceType =
cloudApi.mdb.clickhouse_cluster_service.ListClusterLogsRequest_ServiceType;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ClusterServiceClient);
const result = await client.listLogs(
ListClusterLogsRequest.fromPartial({
clusterId: "clusterId",
// columnFilter: ["columnFilter"],
serviceType: ListClusterLogsRequest_ServiceType.CLICKHOUSE,
// fromTime: {
// seconds: 0,
// nanos: 0
// },
// toTime: {
// seconds: 0,
// nanos: 0
// },
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.dataproc.v1.cluster_service_pb2_grpc import ClusterServiceStub
from yandex.cloud.mdb.clickhouse.v1.cluster_service_pb2 import ListClusterLogsRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(ClusterServiceStub)
response = service.ListLogs(
ListClusterLogsRequest(
cluster_id="clusterId",
# column_filter = ["columnFilter"],
service_type=ListClusterLogsRequest.ServiceType.CLICKHOUSE,
# from_time = Timestamp(
# seconds = 0,
# nanos = 0
# ),
# to_time = Timestamp(
# seconds = 0,
# nanos = 0
# ),
# page_size = 0,
# page_token = "pageToken"
)
)
print(response)
ListClusterLogsRequest
ServiceType
SERVICE_TYPE_UNSPECIFIED
Type is not specified.
OPENSEARCH
OpenSearch logs.
DASHBOARDS
Dashboards logs.
clusterId
: string
ID of the OpenSearch cluster to request logs for.
To get the OpenSearch cluster ID use a ClusterService.List request.
columnFilter
: string
Columns from log table to request. If no columns are specified, entire log records are returned.
fromTime
: google.protobuf.Timestamp
Start timestamp for the logs request.
toTime
: google.protobuf.Timestamp
End timestamp for the logs request.
pageSize
: int64
The maximum number of results per page to return.
If the number of available results is larger than page_size, the service returns a ListClusterLogsResponse.next_page_token that can be used to get the next page of results in subsequent list requests.
pageToken
: string
Page token. To get the next page of results, set page_token to the ListClusterLogsResponse.next_page_token returned by the previous list request.
alwaysNextPageToken
: bool
The service always returns a ListClusterLogsResponse.next_page_token, even if the current page is empty.
filter
: string
A filter expression that filters resources listed in the response.
The expression must specify:
A field name. Currently filtering can be applied to the LogRecord.logs.message.hostname field.
A conditional operator. Can be either
=
or!=
for single values,IN
orNOT IN
for lists of values.A value. Must be 1-63 characters long and match the regular expression
^[a-z0-9.-]{1,61}$
.
Examples of a filter:
message.hostname='node1.db.cloud.yandex.net'
;message.error_severity IN ("ERROR", "FATAL", "PANIC") AND message.hostname = "node1.db.cloud.yandex.net"
.
serviceType
: ServiceType
Type of the service to request logs about.
ListClusterLogsResponse
logs
: LogRecord
Requested log records.
nextPageToken
: string
This token allows you to get the next page of results for list requests.
If the number of results is larger than ListClusterLogsRequest.page_size, use the next_page_token as the value for the ListClusterLogsRequest.page_token query parameter in the next list request.
Each subsequent list request has its own next_page_token to continue paging through the results.
This value is interchangeable with the StreamLogRecord.next_record_token from StreamLogs method.
LogRecord
timestamp
: google.protobuf.Timestamp
Time when the log was recorded.
message
: string
Contents of the log record.