ListLogs
Retrieves logs for the specified PostgreSQL cluster.
- 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
POSTGRESQL
Logs of PostgreSQL activity.
POOLER
Logs of connection pooler activity.
clusterId
: string
ID of the PostgreSQL cluster to request logs for. To get the PostgreSQL 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
Start timestamp for the logs request, in RFC3339 text format.
toTime
: google.protobuf.Timestamp
End timestamp for the logs request, in RFC3339 text format.
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
Always return next_page_token
, even if current page is empty.
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 will have its own next_page_token to continue paging through the results.
This value is interchangeable with next_record_token
from StreamLogs method.
LogRecord
timestamp
: google.protobuf.Timestamp
Log record timestamp in RFC3339 text format.
message
: string
Contents of the log record.