ListLogs
Retrieves logs for a cluster.
Alternatively, logs can be streamed using StreamLogs.
- 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
- MYSQL_ERROR- MySQL error log. 
- MYSQL_GENERAL- MySQL general query log. 
- MYSQL_SLOW_QUERY- MySQL slow query log. 
- MYSQL_AUDIT- MySQL audit log. 
clusterId : string
ID of the cluster to request logs for.
To get this ID, make a ClusterService.List request.
columnFilter : string
Columns from the logs table to request. If no columns are specified, complete log records are returned.
serviceType : ServiceType
The log type.
fromTime : google.protobuf.Timestamp
Start timestamp for the logs request. The logs in the response will be within from_time to to_time range.
toTime : google.protobuf.Timestamp
End timestamp for the logs request. The logs in the response will be within from_time to to_time range.
pageSize : int64
The maximum number of results per page to return.
If the number of available results is larger than page_size, the API returns a ListClusterLogsResponse.next_page_token that can be used to get the next page of results in the subsequent ClusterService.ListLogs requests.
pageToken : string
Page token that can be used to iterate through multiple pages of results.
To get the next page of results, set page_token to the ListClusterLogsResponse.next_page_token returned by the previous ClusterService.ListLogs request.
alwaysNextPageToken : bool
Option that controls the behavior of result pagination.
If it is set to true, then ListClusterLogsResponse.next_page_token will always be returned, even if the current page is empty.
ListClusterLogsResponse
logs : LogRecord
Requested log records.
nextPageToken : string
The token that can be used to get the next page of results.
If the number of results is larger than ListClusterLogsRequest.page_size, use the next_page_token as the value for the ListClusterLogsRequest.page_token in the subsequent ClusterService.ListLogs request to iterate through multiple pages of results.
Each of the subsequent ClusterService.ListLogs requests should use the next_page_token value returned by the previous request to continue paging through the results.
This value is interchangeable with StreamLogRecord.next_record_token from ClusterService.StreamLogs method.
LogRecord
A single log record.
timestamp : google.protobuf.Timestamp
Timestamp of the log record.
message : string
Contents of the log record.