javascriptv3/example_code/cloudwatch-logs/scenarios/large-query/README.md
This example shows how to use AWS SDKs to perform a query on CloudWatch logs and get more than the maximum number of 10,000 logs back.
The CloudWatch Logs API is capped at 10,000 records for requests that read or write. GetLogEvents returns tokens for pagination, but GetQueryResults does not. This example breaks down one query into multiple queries if more than the maximum number of records are returned from the query.
The following components are used in this example:
For general prerequisites, see the README in the javascriptv3 folder.
To run this example, you need a CloudWatch log group that contains over 10,000 logs. You can create one yourself, or you can follow the steps in the Infrastructure and data section. These steps require you to install or update the latest version of the AWS CLI
Use the following steps to create the necessary resources in AWS CloudFormation and use the AWS CLI to upload the necessary logs.
aws cloudformation deploy --template-file stack.yaml --stack-name CloudWatchLargeQuery./make-log-files.sh. This will output two timestamps for use in the following step.export QUERY_START_DATE=<...> and export QUERY_END_DATE=<...> from the make-log-files.sh output../put-log-events.sh.node index.jsCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0