

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 SDK 的 CloudWatch Logs 程式碼範例 AWS SDKs
<a name="cloudwatch-logs_code_examples"></a>

下列程式碼範例示範如何使用 Amazon CloudWatch Logs 搭配 AWS 軟體開發套件 (SDK)。

*Actions* 是大型程式的程式碼摘錄，必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數，但您可以在其相關情境中查看內容中的動作。

*案例*是向您展示如何呼叫服務中的多個函數或與其他 AWS 服務組合來完成特定任務的程式碼範例。

**其他資源**
+  **[ CloudWatch Logs 使用者指南](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html)** – CloudWatch Logs 的相關詳細資訊。
+ **[CloudWatch Logs API 參考](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/Welcome.html)** – 所有可用 CloudWatch Logs 動作的詳細資訊。
+ **[AWS 開發人員中心](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23cloudwatch)** – 您可以依類別或全文搜尋篩選的程式碼範例。
+ **[AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)** – GitHub 儲存庫使用慣用語言的完整程式碼。包含設定和執行程式碼的指示。

**Contents**
+ [基本概念](cloudwatch-logs_code_examples_basics.md)
  + [動作](cloudwatch-logs_code_examples_actions.md)
    + [`AssociateKmsKey`](cloudwatch-logs_example_cloudwatch-logs_AssociateKmsKey_section.md)
    + [`CancelExportTask`](cloudwatch-logs_example_cloudwatch-logs_CancelExportTask_section.md)
    + [`CreateExportTask`](cloudwatch-logs_example_cloudwatch-logs_CreateExportTask_section.md)
    + [`CreateLogGroup`](cloudwatch-logs_example_cloudwatch-logs_CreateLogGroup_section.md)
    + [`CreateLogStream`](cloudwatch-logs_example_cloudwatch-logs_CreateLogStream_section.md)
    + [`DeleteLogGroup`](cloudwatch-logs_example_cloudwatch-logs_DeleteLogGroup_section.md)
    + [`DeleteSubscriptionFilter`](cloudwatch-logs_example_cloudwatch-logs_DeleteSubscriptionFilter_section.md)
    + [`DescribeExportTasks`](cloudwatch-logs_example_cloudwatch-logs_DescribeExportTasks_section.md)
    + [`DescribeLogGroups`](cloudwatch-logs_example_cloudwatch-logs_DescribeLogGroups_section.md)
    + [`DescribeLogStreams`](cloudwatch-logs_example_cloudwatch-logs_DescribeLogStreams_section.md)
    + [`DescribeSubscriptionFilters`](cloudwatch-logs_example_cloudwatch-logs_DescribeSubscriptionFilters_section.md)
    + [`GetLogEvents`](cloudwatch-logs_example_cloudwatch-logs_GetLogEvents_section.md)
    + [`GetQueryResults`](cloudwatch-logs_example_cloudwatch-logs_GetQueryResults_section.md)
    + [`PutSubscriptionFilter`](cloudwatch-logs_example_cloudwatch-logs_PutSubscriptionFilter_section.md)
    + [`StartLiveTail`](cloudwatch-logs_example_cloudwatch-logs_StartLiveTail_section.md)
    + [`StartQuery`](cloudwatch-logs_example_cloudwatch-logs_StartQuery_section.md)
+ [案例](cloudwatch-logs_code_examples_scenarios.md)
  + [設定 Amazon ECS Service Connect](cloudwatch-logs_example_ecs_ServiceConnect_085_section.md)
  + [建立您的第一個 Lambda 函數](cloudwatch-logs_example_lambda_GettingStarted_019_section.md)
  + [執行大型查詢](cloudwatch-logs_example_cloudwatch-logs_Scenario_BigQuery_section.md)
  + [使用排程事件來調用 Lambda 函式](cloudwatch-logs_example_cross_LambdaScheduledEvents_section.md)