Skip to main content

ListLogs

Retrieves logs for the specified SQL Server cluster.

For more information about logs, see the Logs section in the documentation.

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);
})();

ListClusterLogsRequest

ServiceType

  • SERVICE_TYPE_UNSPECIFIED

  • SQLSERVER_ERROR

    SQL Server error log.

  • SQLSERVER_APPLICATION

    SQL Server application log.

clusterId : string

ID of the SQL Server cluster to request logs for.

To get the SQL Server cluster ID, use a ClusterService.List request.

columnFilter : string

Columns from the logs table to request.

If no columns are specified, entire log records are returned.

serviceType : ServiceType

Type of the service to request logs about.

fromTime : google.protobuf.Timestamp

Specifies a moment that the logs are requested from.

toTime : google.protobuf.Timestamp

Specifies a moment that the logs are requested till.

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 returns 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:

  1. A field name to filter by. Currently filtering can be applied to the LogRecord.logs.message.hostname field only.
  2. A conditional operator. Can be either = or != for single values, IN or NOT IN for lists of values.
  3. A value. Must be 1-63 characters long and match the regular expression [a-z0-9.-]{1,61}.

Example of a filter: message.hostname='node1.db.cloud.yandex.net'.

ListClusterLogsResponse

logs : LogRecord

Requested log records.

nextPageToken : string

Token that 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.

LogRecord

timestamp : google.protobuf.Timestamp

Log record timestamp.

message : string

Contents of the log record.