

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 通过屏蔽帮助保护敏感的日志数据
<a name="mask-sensitive-log-data"></a>

您可以使用 CloudWatch 日志组数据保护*策略来帮助保护 Logs 摄取的敏感数据*。使用这些策略可以审核和屏蔽账户中日志组提取的日志事件中出现的敏感数据。

创建数据保护策略时，默认情况下，与您选择的数据标识符匹配的敏感数据将在所有出口点被屏蔽，包括 Lo CloudWatch gs Insights、指标筛选器和订阅筛选器。只有拥有 `logs:Unmask` IAM 权限的用户才能查看未屏蔽的数据。

您可以为账户中所有日志组创建数据保护策略，也可以为各个日志组创建数据保护策略。当为整个账户创建策略时，它既适用于现有日志组，也适用于将来创建的日志组。

如果为整个账户创建了数据保护策略，并且还为单个日志组创建了策略，则这两个策略都适用于该日志组。任一策略中指定的所有托管数据标识符都会在该日志组中进行审核和屏蔽。

**注意**  
标准和不频繁访问日志类中的日志组都支持屏蔽敏感数据。有关日志类的更多信息，请参阅 [日志类](CloudWatch_Logs_Log_Classes.md)。

每个日志组只能有一个日志组级别的数据保护策略，但是该策略可以指定许多要审核和屏蔽的托管数据标识符。数据保护策略的限制为 30,720 个字符。

**重要**  
将敏感数据摄入日志组时会进行检测并屏蔽。设置数据保护策略时，不会屏蔽在该时间之前摄入到日志组的日志事件。

CloudWatch 日志支持许多*托管数据标识符*，这些标识符提供了预配置的数据类型，您可以选择这些数据类型来保护财务数据、个人健康信息 (PHI) 和个人身份信息 (PII)。 CloudWatch 日志数据保护允许您利用模式匹配和机器学习模型来检测敏感数据。对于某些类型的托管数据标识符，检测还取决于是否找到与敏感数据接近的某些关键字。您还可以使用自定义数据标识符来创建针对特定使用场景量身定制的数据标识符。

当检测到与您选择的数据标识符匹配的敏感数据 CloudWatch 时，就会发出一个指标。这是**LogEventsWithFindings**指标，它在 **AWS/** Logs 命名空间中发布。您可以使用此指标来创建 CloudWatch 警报，也可以在图表和仪表板中将其可视化。数据保护发出的指标是出售的指标，是免费的。有关 CloudWatch 日志发送到的指标的更多信息 CloudWatch，请参阅[使用 CloudWatch 指标进行监控](CloudWatch-Logs-Monitoring-CloudWatch-Metrics.md)。

每个托管数据标识符都旨在检测特定类型的敏感数据，例如信用卡号、 AWS 秘密访问密钥或特定国家或地区的护照号码。创建数据保护策略时，您可以将其配置为使用这些标识符来分析通过日志组摄取的日志，并在检测到敏感数据时采取措施。

CloudWatch 日志数据保护可以使用托管数据标识符检测以下类别的敏感数据：
+ 证书，例如私钥或私有访问 AWS 密钥 
+ 财务信息，例如信用卡号
+ 个人身份信息（PII），例如驾驶执照或社会安全号码
+ 受保护健康信息（PHI），例如健康保险或医疗识别号码
+ 设备标识符，例如 IP 地址或 MAC 地址

有关您可以保护的数据类型的详细信息，请参阅 [您可以保护的数据类型](protect-sensitive-log-data-types.md)。

**Contents**
+ [了解数据保护策略](cloudwatch-logs-data-protection-policies.md)
  + [什么是数据保护策略？](cloudwatch-logs-data-protection-policies.md#what-are-data-protection-policies)
  + [数据保护策略采用什么结构？](cloudwatch-logs-data-protection-policies.md#overview-of-data-protection-policies)
    + [数据保护策略的 JSON 属性](cloudwatch-logs-data-protection-policies.md#data-protection-policy-json-properties)
    + [策略语句的 JSON 属性](cloudwatch-logs-data-protection-policies.md#policy-statement-json-properties)
    + [策略语句操作的 JSON 属性](cloudwatch-logs-data-protection-policies.md#statement-operation-json-properties)
+ [创建或使用数据保护策略所需的 IAM 权限](data-protection-policy-permissions.md)
  + [账户级数据保护策略所需的权限](data-protection-policy-permissions.md#data-protection-policy-permissions-accountlevel)
  + [单个日志组的数据保护策略所需的权限](data-protection-policy-permissions.md#data-protection-policy-permissions-loggroup)
  + [数据保护策略示例](data-protection-policy-permissions.md#data-protection-policy-sample)
+ [创建账户范围的数据保护策略](mask-sensitive-log-data-accountlevel.md)
  + [控制台](mask-sensitive-log-data-accountlevel.md#mask-sensitive-log-data-accountlevel-console)
  + [AWS CLI](mask-sensitive-log-data-accountlevel.md#mask-sensitive-log-data-accountlevel-cli)
    + [AWS CLI 或 API 操作的数据保护策略语法](mask-sensitive-log-data-accountlevel.md#mask-sensitive-log-data-policysyntax-account)
+ [为单个日志组创建数据保护策略](mask-sensitive-log-data-start.md)
  + [控制台](mask-sensitive-log-data-start.md#mask-sensitive-log-data-start-console)
  + [AWS CLI](mask-sensitive-log-data-start.md#mask-sensitive-log-data-start-cli)
    + [AWS CLI 或 API 操作的数据保护策略语法](mask-sensitive-log-data-start.md#mask-sensitive-log-data-policysyntax)
+ [查看未屏蔽的数据](mask-sensitive-log-data-viewunmasked.md)
+ [审计结果报告](mask-sensitive-log-data-audit-findings.md)
  + [将审计结果发送到受保护的存储桶所需的密钥策略 AWS KMS](mask-sensitive-log-data-audit-findings.md#mask-sensitive-log-data-audit-findings-kms)
+ [您可以保护的数据类型](protect-sensitive-log-data-types.md)
  + [CloudWatch 记录敏感数据类型的托管数据标识符](CWL-managed-data-identifiers.md)
    + [凭据](protect-sensitive-log-data-types-credentials.md)
      + [凭证数据 ARNs 类型的数据标识符](protect-sensitive-log-data-types-credentials.md#cwl-data-protection-credentials-arns)
    + [设备标识符](protect-sensitive-log-data-types-device.md)
      + [设备数据类型的数据 ARNs 标识符](protect-sensitive-log-data-types-device.md#cwl-data-protection-devices-arns)
    + [财务信息](protect-sensitive-log-data-types-financial.md)
      + [财务数据类型的数据 ARNs 标识符](protect-sensitive-log-data-types-financial.md#cwl-data-protection-financial-arns)
    + [受保护健康信息（PHI）](protect-sensitive-log-data-types-health.md)
      + [受保护 ARNs 的健康信息数据类型 (PHI) 的数据标识符](protect-sensitive-log-data-types-health.md#cwl-data-protection-phi-arns)
    + [个人身份信息（PII）](protect-sensitive-log-data-types-pii.md)
      + [驾驶执照识别号的关键字](protect-sensitive-log-data-types-pii.md#CWL-managed-data-identifiers-pii-dl-keywords)
      + [国民身份证号的关键字](protect-sensitive-log-data-types-pii.md#CWL-managed-data-identifiers-pii-natlid-keywords)
      + [护照号码的关键字](protect-sensitive-log-data-types-pii.md#CWL-managed-data-identifiers-pii-passport-keywords)
      + [纳税人识别号和参考号的关键字](protect-sensitive-log-data-types-pii.md#CWL-managed-data-identifiers-financial-tin-keywords)
      + [个人身份信息 (PII) 的数据标识符 ARNs](protect-sensitive-log-data-types-pii.md#CWL-data-protection-pii-arns)
  + [自定义数据标识符](CWL-custom-data-identifiers.md)
    + [什么是自定义数据标识符？](CWL-custom-data-identifiers.md#what-are-custom-data-identifiers)
    + [自定义数据标识符限制](CWL-custom-data-identifiers.md#custom-data-identifiers-constraints)
    + [在控制台中使用自定义数据标识符](CWL-custom-data-identifiers.md#using-custom-data-identifiers-console)
    + [在数据保护策略中使用自定义数据标识符](CWL-custom-data-identifiers.md#using-custom-data-identifiers)