ListLogs
Retrieves logs for the specified Apache Kafka® cluster.
For more information about logs, see the Logs section in the documentation.
- 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
clusterId
: string
ID of the Apache Kafka® cluster to request logs for.
To get the Apache Kafka® cluster ID, make a ClusterService.List request.
columnFilter
: string
Columns from the logs table to request.
If no columns are specified, full 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 flag that defines behavior of providing the next page token.
If this flag is set to true
, this API method will always return ListClusterLogsResponse.next_page_token, even if current page is empty.
filter
: string
A filter expression that filters resources listed in the response.
The expression must specify:
- The field name to filter by. Currently filtering can be applied to the
hostname
field. - An
=
operator. - The value in double quotes (
"
). 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 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 StreamLogRecord.next_record_token from StreamLogs method.
LogRecord
A single log record.
timestamp
: google.protobuf.Timestamp
Log record timestamp.
message
: string
Contents of the log record.