|
1 | | -# CloudWatch Logs Examples for .NET |
| 1 | +# CloudWatch Logs code examples for the SDK for .NET (v4) |
2 | 2 |
|
3 | | -This folder contains examples for Amazon CloudWatch Logs using the AWS SDK for .NET. |
| 3 | +## Overview |
4 | 4 |
|
5 | | -## Examples |
| 5 | +Shows how to use the AWS SDK for .NET (v4) to work with Amazon CloudWatch Logs. |
6 | 6 |
|
7 | | -### Feature Scenarios |
| 7 | +<!--custom.overview.start--> |
| 8 | +<!--custom.overview.end--> |
8 | 9 |
|
9 | | -- **[LargeQuery](LargeQuery/)** - Demonstrates how to perform large-scale queries on CloudWatch Logs using recursive binary search to retrieve more than the 10,000 result limit. |
| 10 | +_CloudWatch Logs monitor, store, and access your log files from Amazon Elastic Compute Cloud instances, AWS CloudTrail, or other sources._ |
10 | 11 |
|
11 | | -## Running the Examples |
| 12 | +## ⚠ Important |
12 | 13 |
|
13 | | -Each example includes its own README with specific instructions. Generally, you can: |
| 14 | +* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/). |
| 15 | +* Running the tests might result in charges to your AWS account. |
| 16 | +* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). |
| 17 | +* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). |
14 | 18 |
|
15 | | -1. Navigate to the example directory |
16 | | -2. Build the solution: `dotnet build` |
17 | | -3. Run the example: `dotnet run --project Scenarios/{ProjectName}.csproj` |
18 | | -4. Run tests: `dotnet test` |
| 19 | +<!--custom.important.start--> |
| 20 | +<!--custom.important.end--> |
19 | 21 |
|
20 | | -## Prerequisites |
| 22 | +## Code examples |
21 | 23 |
|
22 | | -- .NET 8.0 or later |
23 | | -- AWS credentials configured |
24 | | -- Appropriate AWS permissions for CloudWatch Logs |
| 24 | +### Prerequisites |
25 | 25 |
|
26 | | -## Additional Resources |
| 26 | +For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv4` folder. |
27 | 27 |
|
28 | | -- [CloudWatch Logs Documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/) |
29 | | -- [AWS SDK for .NET Documentation](https://docs.aws.amazon.com/sdk-for-net/) |
30 | | -- [CloudWatch Logs API Reference](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/) |
| 28 | + |
| 29 | +<!--custom.prerequisites.start--> |
| 30 | +<!--custom.prerequisites.end--> |
| 31 | + |
| 32 | +### Single actions |
| 33 | + |
| 34 | +Code excerpts that show you how to call individual service functions. |
| 35 | + |
| 36 | +- [GetQueryResults](LargeQuery/Actions/CloudWatchLogsWrapper.cs#L79) |
| 37 | +- [PutLogEvents](LargeQuery/Actions/CloudWatchLogsWrapper.cs#L110) |
| 38 | +- [StartQuery](LargeQuery/Actions/CloudWatchLogsWrapper.cs#L30) |
| 39 | + |
| 40 | +### Scenarios |
| 41 | + |
| 42 | +Code examples that show you how to accomplish a specific task by calling multiple |
| 43 | +functions within the same service. |
| 44 | + |
| 45 | +- [Run a large query](LargeQuery/Scenarios/LargeQueryWorkflow.cs) |
| 46 | + |
| 47 | + |
| 48 | +<!--custom.examples.start--> |
| 49 | +<!--custom.examples.end--> |
| 50 | + |
| 51 | +## Run the examples |
| 52 | + |
| 53 | +### Instructions |
| 54 | + |
| 55 | + |
| 56 | +<!--custom.instructions.start--> |
| 57 | +<!--custom.instructions.end--> |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +#### Run a large query |
| 62 | + |
| 63 | +This example shows you how to use CloudWatch Logs to query more than 10,000 records. |
| 64 | + |
| 65 | + |
| 66 | +<!--custom.scenario_prereqs.cloudwatch-logs_Scenario_BigQuery.start--> |
| 67 | +<!--custom.scenario_prereqs.cloudwatch-logs_Scenario_BigQuery.end--> |
| 68 | + |
| 69 | + |
| 70 | +<!--custom.scenarios.cloudwatch-logs_Scenario_BigQuery.start--> |
| 71 | +<!--custom.scenarios.cloudwatch-logs_Scenario_BigQuery.end--> |
| 72 | + |
| 73 | +### Tests |
| 74 | + |
| 75 | +⚠ Running tests might result in charges to your AWS account. |
| 76 | + |
| 77 | + |
| 78 | +To find instructions for running these tests, see the [README](../README.md#Tests) |
| 79 | +in the `dotnetv4` folder. |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +<!--custom.tests.start--> |
| 84 | +<!--custom.tests.end--> |
| 85 | + |
| 86 | +## Additional resources |
| 87 | + |
| 88 | +- [CloudWatch Logs User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html) |
| 89 | +- [CloudWatch Logs API Reference](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/Welcome.html) |
| 90 | +- [SDK for .NET (v4) CloudWatch Logs reference](https://docs.aws.amazon.com/sdkfornet/v4/apidocs/items/Cloudwatch-logs/NCloudwatch-logs.html) |
| 91 | + |
| 92 | +<!--custom.resources.start--> |
| 93 | +<!--custom.resources.end--> |
31 | 94 |
|
32 | 95 | --- |
33 | 96 |
|
34 | 97 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 98 | + |
35 | 99 | SPDX-License-Identifier: Apache-2.0 |
0 commit comments