

# （推荐）增强调查的最佳实践
<a name="Investigations-RecommendedServices"></a>

作为最佳实践，我们建议您在账户中启用多项 AWS 服务和功能，帮助 CloudWatch 调查在您的拓扑中发现更多信息，并在调查期间提出更好的建议。

**Topics**
+ [CloudWatch 代理](#Investigations-CloudWatchAgent)
+ [AWS CloudTrail](#Investigations-CloudTrail)
+ [CloudWatch Application Signals](#Investigations-ApplicationSignals)
+ [X-Ray](#Investigations-Xray)
+ [Container Insights](#Investigations-ContainerInsights)
+ [数据库洞察](#Investigations-DatabaseInsights)

## CloudWatch 代理
<a name="Investigations-CloudWatchAgent"></a>

我们建议您在服务器上安装最新版本的 CloudWatch 代理。使用最新版本的 CloudWatch 代理可以增强调查期间在 Amazon EC2 和 Amazon EBS 中发现问题的能力。您至少应使用 CloudWatch 代理版本 1.300049.1 或更高版本。有关 CloudWatch 代理将其安装方式的更多信息，请参阅 [使用 CloudWatch 代理采集指标、日志和跟踪数据](Install-CloudWatch-Agent.md)。

## AWS CloudTrail
<a name="Investigations-CloudTrail"></a>

建议配置 CloudTrail 跟踪，将管理事件发送到 CloudWatch Logs。CloudTrail 会记录有关 AWS 账户中控制面板操作的管理事件，例如配置权限策略以及创建、修改和更新资源。当 CloudTrail 事件发送到 CloudWatch Logs 时，CloudWatch 调查功能可以分析 AWS 账户中的这些事件，检测账户中与调查相关的变化。有关更多信息，请参阅 [What is AWS CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html)、[Creating a trail with the CloudTrail console](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)、[Working with CloudTrail trails](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-trails.html) 以及 [Sending events to CloudWatch Logs](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/send-cloudtrail-events-to-cloudwatch-logs.html)。

**注意**  
CloudWatch 调查功能只能分析来自跟踪的 CloudTrail 事件，这些跟踪将事件发送到开展调查的同一 AWS 区域的 CloudWatch Logs。对于跨账户调查，该功能会审查开展调查的同一区域中每个已配置账户的 CloudTrail 跟踪。

## CloudWatch Application Signals
<a name="Investigations-ApplicationSignals"></a>

CloudWatch Application Signals 会发现您环境的拓扑，包括您的应用程序及其依赖关系。还会自动收集延迟和可用性等标准指标。通过启用 Application Signals，CloudWatch 调查可以在调查期间使用此拓扑和指标信息。

有关 Application Signals 的更多信息，请参阅 [Application Signals](CloudWatch-Application-Monitoring-Sections.md)。

## X-Ray
<a name="Investigations-Xray"></a>

我们建议您启用 AWS X-Ray。X-Ray 收集有关应用程序所服务请求的跟踪。对于任何被跟踪的向您应用程序发出的请求，您不仅可以查看请求和响应的详细信息，还可以查看您的应用程序对下游 AWS 资源、微服务、数据库和 Web API 进行的调用的详细信息。此信息可在 CloudWatch 调查过程中提供关键支持。

有关更多信息，请参阅 [What is AWS X-Ray](https://docs.aws.amazon.com/xray/latest/devguide/aws-xray.html)****

## Container Insights
<a name="Investigations-ContainerInsights"></a>

如果您使用 Amazon ECS 或 Amazon EKS，我们建议您安装 Container Insights。这提升了 CloudWatch 在您的容器中排查问题的能力。有关 CloudWatch 代理将其安装方式的更多信息，请参阅 [Container Insights](ContainerInsights.md)。

## 数据库洞察
<a name="Investigations-DatabaseInsights"></a>

如果使用 Amazon RDS，建议在数据库实例上启用数据库洞察的高级模式。数据库洞察会对数据库负载进行监控并提供详细的性能分析，帮助 CloudWatch 调查功能在调查期间识别与数据库相关的问题。启用高级数据库洞察后，CloudWatch 调查功能可以自动生成性能分析报告，其中包含详细的观察结果、指标异常、根本原因分析以及针对数据库工作负载的建议。有关更多信息，请参阅 [Monitoring Amazon RDS databases with CloudWatch Database Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.html)。