Skip to content

Latest commit

 

History

History
81 lines (54 loc) · 3.33 KB

README.md

File metadata and controls

81 lines (54 loc) · 3.33 KB

AWS SDK for Rust code examples for CloudWatch Logs

Purpose

These examples demonstrate how to perform several Amazon CloudWatch Logs operations using the developer preview version of the AWS SDK for Rust.

Use CloudWatch Logs to monitor, store, and access your log files from Amazon Elastic Compute Cloud instances, AWS CloudTrail, or other sources.

Code examples

⚠ Important

  • We recommend that you grant this code least privilege, or at most the minimum permissions required to perform the task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
  • This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions.
  • Running this code might result in charges to your AWS account.

Running the code examples

Prerequisites

You must have an AWS account, and have configured your default credentials and AWS Region as described in https://github.com/awslabs/aws-sdk-rust.

get-log-events

This example lists the events for a log stream in the Region.

cargo run --bin get-log-events -- -g GROUP -s STREAM [-r REGION] [-v]

  • GROUP is the name of the log group.
  • STREAM is the name of the log stream.
  • REGION is name of the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

list-log-groups

This example lists your log groups in the Region.

cargo run --bin list-log-groups -- [-r REGION] [-v]

  • REGION is name of the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

list-log-streams

This example lists the log streams for a log group in the Region.

cargo run --bin list-log-streams -- -g GROUP [-r REGION] [-v]

  • GROUP is the name of the log group.
  • REGION is name of the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

Resources

Contributing

To propose a new code example to the AWS documentation team, see CONTRIBUTING.md. The team prefers to create code examples that show broad scenarios rather than individual API calls.

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0