

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

# 使用遮罩功能協助保護敏感日誌資料
<a name="mask-sensitive-log-data"></a>

您可以使用日誌群組*資料保護政策*，協助保護 CloudWatch Logs 擷取的敏感資料。這些政策可讓您稽核和遮罩出現在帳戶中日誌群組擷取之日誌事件中的敏感資料。

建立資料保護政策後，預設為會在所有出口點遮罩與您選取的資料識別符相符的敏感資料，包括 CloudWatch Logs Insights、指標篩選條件和訂閱篩選條件。只有具有 `logs:Unmask` IAM 許可的使用者才能檢視未遮罩的資料。

您可以為帳戶中的所有日誌群組建立資料保護政策，也可以為個別日誌群組建立資料保護政策。當您為整個帳戶建立政策時，它會套用至現有的日誌群組和未來建立的日誌群組。

如果您為整個帳戶建立資料保護政策，並且也為單一日誌群組建立政策，則這兩個政策都會套用至該日誌群組。在任一政策中指定的所有受管資料識別符都會在該日誌群組中進行稽核和遮罩。

**注意**  
標準和不常存取日誌類別中的日誌群組都支援遮罩敏感資料。如需日誌類別的詳細資訊，請參閱 [日誌類別](CloudWatch_Logs_Log_Classes.md)。

每個日誌群組只能有一個日誌群組層級資料保護政策，但該政策可以指定許多受管資料識別符來稽核和遮罩。資料保護政策的限制為 30,720 個字元。

**重要**  
將敏感資料擷取至日誌群組時，系統會偵測這些資料並加以遮罩。系統不會遮罩在您設定資料保護政策之前擷取至日誌群組的日誌事件。

CloudWatch Logs 支援許多*受管資料識別符*，提供預先設定的資料類型，您可以選擇這些資料類型來保護財務資料、個人健康資訊 (PHI) 和個人身分識別資訊 (PII)。CloudWatch Logs 資料保護功能可讓您利用模式比對和機器學習模型來偵測敏感資料。對於某些類型的受管資料識別符，偵測也取決於尋找與敏感資料相鄰的特定關鍵字。您也可以使用自訂資料識別符來建立針對特定使用案例量身打造的資料識別符。

當偵測到符合您所選取資料識別碼的敏感資料時，就會向 CloudWatch 發出指標。這是 **LogEventsWithFindings** 指標，其在 **AWS/Logs** 命名空間中發出。您可以使用此指標建立 CloudWatch 警示，並且可以在圖形和儀表板中將其視覺化。資料保護發出的指標是付費指標，但在此免費提供。如需有關 CloudWatch Logs 傳送至 CloudWatch 之指標的詳細資訊，請參閱 [使用 CloudWatch 指標監控使用量](CloudWatch-Logs-Monitoring-CloudWatch-Metrics.md)。

每個受管資料識別符旨在偵測特定類型的敏感資料，例如特定國家或地區的信用卡號碼、 AWS 私密存取金鑰或護照號碼。建立資料保護政策時，您可以將 CloudWatch Logs 設定為使用這些識別符，來分析由日誌群組擷取的日誌，並在偵測到日誌時採取動作。

CloudWatch Logs 資料保護功能可以使用受管資料識別符，偵測下列類別的敏感資料：
+ 登入資料，例如私有金鑰或 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 Logs 受管資料識別符](CWL-managed-data-identifiers.md)
    + [憑證](protect-sensitive-log-data-types-credentials.md)
      + [憑證資料類型的資料識別符 ARN](protect-sensitive-log-data-types-credentials.md#cwl-data-protection-credentials-arns)
    + [裝置識別符](protect-sensitive-log-data-types-device.md)
      + [裝置資料類型的資料識別符 ARN](protect-sensitive-log-data-types-device.md#cwl-data-protection-devices-arns)
    + [財務資訊](protect-sensitive-log-data-types-financial.md)
      + [財務資料類型的資料識別符 ARN](protect-sensitive-log-data-types-financial.md#cwl-data-protection-financial-arns)
    + [受保護醫療資訊 (PHI)](protect-sensitive-log-data-types-health.md)
      + [受保護醫療資訊 (PHI) 資料類型的資料識別符 ARN](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) 的資料識別符 ARN](protect-sensitive-log-data-types-pii.md#CWL-data-protection-pii-arns)
  + [自訂資料識別符](CWL-custom-data-identifiers.md)
    + [什麼是 SNS 自訂資料識別符？](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)

# 了解資料保護政策
<a name="cloudwatch-logs-data-protection-policies"></a>

**Topics**
+ [什麼是資料保護政策？](#what-are-data-protection-policies)
+ [資料保護政策的結構如何？](#overview-of-data-protection-policies)

## 什麼是資料保護政策？
<a name="what-are-data-protection-policies"></a>

CloudWatch Logs 使用**資料保護政策**來選取您要掃描的敏感資料，以及您想要執行以保護資料的動作。若要選擇感興趣的敏感資料，請使用[資料識別符](CWL-managed-data-identifiers.md)。然後，CloudWatch Logs 資料資料保護會使用機器學習和模式比對來偵測敏感資料。若要根據找到的資料識別符採取行動，您可以定義**稽核**和**去識別化**操作。這些操作可讓您記錄找到 (或未找到) 的敏感資料，並在檢視日誌事件時遮罩敏感資料。

## 資料保護政策的結構如何？
<a name="overview-of-data-protection-policies"></a>

如下圖所示，資料保護政策文件包含以下元素：
+ 在文件最上方選用的整體政策資訊
+ 定義稽核和去識別動作的一條陳述式

每個 CloudWatch Logs 日誌群組只能定義一種資料保護政策。資料保護政策可以有一或多個拒絕或去識別化陳述式，但只能有一個稽核陳述式。

### 資料保護政策的 JSON 屬性
<a name="data-protection-policy-json-properties"></a>

資料保護政策需要下列基本政策資訊才能識別：
+ **Name** - 政策名稱。
+ **Description** (選用) - 政策描述。
+ **Version** - 政策語言版本。目前版本是 2021-06-01。
+ **Statement** - 指定資料保護政策動作的陳述式清單。

```
{
  "Name": "CloudWatchLogs-PersonalInformation-Protection",
  "Description": "Protect basic types of sensitive data",
  "Version": "2021-06-01",
  "Statement": [
        ...
  ]
}
```

### 政策陳述式的 JSON 屬性
<a name="policy-statement-json-properties"></a>

政策陳述式會設定資料保護操作的偵測內容。
+ **Sid** (選用) - 陳述式識別符。
+ **DataIdentifier** – CloudWatch Logs 應掃描的敏感資料。例如，姓名、地址或電話號碼。
+ **操作** – 后續動作 (**稽核**或**去識別**)。CloudWatch Logs 會在找到敏感資料時執行這些動作。

```
{
  ...
  "Statement": [
    {
      "Sid": "audit-policy",
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/Address"
      ],
      "Operation": {
        "Audit": {
          "FindingsDestination": {}
        }
      }
    },
```

### 政策陳述式操作的 JSON 屬性
<a name="statement-operation-json-properties"></a>

政策陳述式會設定下列其中一項資料保護操作。
+ **稽核** – 發出指標和問題清單報告，而不會中斷日誌記錄。符合的字串會增加 **LogEventsWithFindings** 指標，CloudWatch Logs 將此指標發佈到 CloudWatch 中的 **AWS/Logs** 命名空間。您可以使用這些指標建立警示。

  如需問題清單報告的範例，請參閱 [稽核問題清單報告](mask-sensitive-log-data-audit-findings.md)。

  如需有關 CloudWatch Logs 傳送至 CloudWatch 之指標的詳細資訊，請參閱 [使用 CloudWatch 指標監控使用量](CloudWatch-Logs-Monitoring-CloudWatch-Metrics.md)。
+ **去識別** – 遮罩敏感資料，而不會中斷日誌記錄。

# 必須具備 IAM 許可才能建立或使用資料保護政策
<a name="data-protection-policy-permissions"></a>

若要能夠使用日誌群組的資料保護政策，您必須具有下表所示的特定許可。帳戶層級的資料保護政策和套用至單一日誌群組的資料保護政策的許可有所不同。

## 帳戶層級資料保護政策所需的許可
<a name="data-protection-policy-permissions-accountlevel"></a>

**注意**  
如果您要在 Lambda 函數內執行這些作業，Lambda 執行角色和許可界限也必須包含下列許可。

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/AmazonCloudWatch/latest/logs/data-protection-policy-permissions.html)

如果有任何資料保護稽核日誌已傳送至目的地，則也將日誌傳送至相同目的地的其他策略僅需要 `logs:PutDataProtectionPolicy` 和 `logs:CreateLogDelivery` 許可。

## 單一日誌群組之資料保護政策所需的許可
<a name="data-protection-policy-permissions-loggroup"></a>

**注意**  
如果您要在 Lambda 函數內執行這些作業，Lambda 執行角色和許可界限也必須包含下列許可。


| 作業 | 需要 IAM 許可 | 資源 | 
| --- | --- | --- | 
|  建立不具有稽核目的地的資料保護政策  |  `logs:PutDataProtectionPolicy`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*`  | 
|  建立以 CloudWatch Logs 為稽核目的地的資料保護政策  |  `logs:PutDataProtectionPolicy` `logs:CreateLogDelivery` `logs:PutResourcePolicy` `logs:DescribeResourcePolicies` `logs:DescribeLogGroups`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*` `*` `*` `*` `*`  | 
|  使用 Firehose 作為稽核目的地來建立資料保護政策  |  `logs:PutDataProtectionPolicy` `logs:CreateLogDelivery` `firehose:TagDeliveryStream`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*` `*` `arn:aws:logs:::deliverystream/YOUR_DELIVERY_STREAM`  | 
|  建立以 Amazon S3 為稽核目的地的資料保護政策  |  `logs:PutDataProtectionPolicy` `logs:CreateLogDelivery` `s3:GetBucketPolicy` `s3:PutBucketPolicy`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*` `*` `arn:aws:s3:::YOUR_BUCKET` `arn:aws:s3:::YOUR_BUCKET`  | 
|  取消遮罩已遮罩的日誌事件  |  `logs:Unmask`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*`  | 
|  檢視現有的資料保護政策  |  `logs:GetDataProtectionPolicy`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*`  | 
|  刪除資料保護政策  |  `logs:DeleteDataProtectionPolicy`  |  `arn:aws:logs:::log-group:YOUR_LOG_GROUP:*`  | 

如果有任何資料保護稽核日誌已傳送至目的地，則也將日誌傳送至相同目的地的其他策略僅需要 `logs:PutDataProtectionPolicy` 和 `logs:CreateLogDelivery` 許可。

## 資料保護政策範例
<a name="data-protection-policy-sample"></a>

下列政策範例可讓使用者建立、檢視及刪除資料保護政策，這些政策可將稽核調查結果傳送至全部三種稽核目的地類型。它不允許使用者檢視未遮罩的資料。

------
#### [ JSON ]

****  

```
 
    {
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowLogDeliveryConfiguration",
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogDelivery",
                "logs:PutResourcePolicy",
                "logs:DescribeLogGroups",
                "logs:DescribeResourcePolicies"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowDataProtectionAndBucketConfiguration",
            "Effect": "Allow",
            "Action": [
                "logs:GetDataProtectionPolicy",
                "logs:DeleteDataProtectionPolicy",
                "logs:PutDataProtectionPolicy",
                "s3:PutBucketPolicy",
                "firehose:TagDeliveryStream",
                "s3:GetBucketPolicy"
            ],
            "Resource": [
            "arn:aws:firehose:us-east-1:111122223333:deliverystream/delivery-stream-name",
            "arn:aws:s3:::amzn-s3-demo-destination-bucket",
            "arn:aws:logs:us-east-1:111122223333:log-group:log-group-name:*"
            ]
        }
    ]
}
```

------

# 建立帳戶層級資料保護政策
<a name="mask-sensitive-log-data-accountlevel"></a>

您可以使用 CloudWatch Logs 主控台或 AWS CLI 命令來建立資料保護政策，以遮罩帳戶中所有日誌群組的敏感資料。這樣做會影響目前的日誌群組和您未來建立的日誌群組。

**重要**  
將敏感資料擷取至日誌群組時，系統會偵測這些資料並加以遮罩。系統不會遮罩在您設定資料保護政策之前擷取至日誌群組的日誌事件。

**Topics**
+ [主控台](#mask-sensitive-log-data-accountlevel-console)
+ [AWS CLI](#mask-sensitive-log-data-accountlevel-cli)

## 主控台
<a name="mask-sensitive-log-data-accountlevel-console"></a>

**使用主控台建立帳戶層級資料保護政策**

1. 透過 [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 開啟 CloudWatch 主控台。

1.  在導覽窗格中，選擇 ** Settings** (設定)。它位於清單底部附近。

1. 選擇 **Logs (日誌)** 索引標籤。

1. 選擇**設定**。

1. 針對**受管資料識別符**，選取您要為所有日誌群組稽核和遮罩的資料類型。您可以在選取方塊中輸入內容以尋找所需的識別符。

   我們建議您只選取與日誌資料和業務相關的資料識別符。選擇的資料類型過多可能會導致誤報。

   如需有關可保護的資料類型的詳細資訊，請參閱[您可以保護的資料類型](protect-sensitive-log-data-types.md)。

1. （選用） 如果您想要使用自訂資料識別符稽核和遮罩其他類型的資料，請選擇**新增自訂資料識別**符。然後輸入資料類型的名稱，以及用來在日誌事件中搜尋該資料類型的規則表達式。如需詳細資訊，請參閱[自訂資料識別符](CWL-custom-data-identifiers.md)。

   單一資料保護政策最多可包含 10 個自訂資料識別符。每個定義自訂資料識別符的規則表達式都必須為 200 個字元或更少。

1. (選用) 選擇向其傳送稽核問題清單的一或多個服務。即使您選擇不將稽核問題清單傳送至任何這些服務，系統仍然會遮罩您選取的敏感資料類型。

1. 選擇 **Activate data protection** (啟動資料保護)。

## AWS CLI
<a name="mask-sensitive-log-data-accountlevel-cli"></a>

**使用 AWS CLI 建立資料保護政策**

1. 使用文字編輯器來建立名為 `DataProtectionPolicy.json` 的政策檔案。如需有關政策語法的資訊，請參閱下一節。

1. 輸入以下命令：

   ```
   aws logs put-account-policy \
   --policy-name TEST_POLICY --policy-type "DATA_PROTECTION_POLICY" \
   --policy-document file://policy.json \
   --scope "ALL" \
   --region us-west-2
   ```

### AWS CLI 或 API 操作的資料保護政策語法
<a name="mask-sensitive-log-data-policysyntax-account"></a>

當您建立要在 AWS CLI 命令或 API 操作中使用的 JSON 資料保護政策時，該政策必須包含兩個 JSON 區塊：
+ 第一個區塊必須同時包含 `DataIdentifer` 陣列和具有 `Audit` 動作的 `Operation` 屬性。`DataIdentifer` 陣列會列出您要遮罩的敏感資料類型。如需所有可用選項的詳細資訊，請參閱[您可以保護的資料類型](protect-sensitive-log-data-types.md)。

  具有 `Audit` 動作的 `Operation` 屬性為必要項目，如此才能找到敏感資料術語。此 `Audit` 動作必須包含 `FindingsDestination` 物件。您可以選擇使用此 `FindingsDestination` 物件，來列出要向其傳送稽核問題清單報告的一或多個目的地。如果您指定目標，例如日誌群組、Amazon Data Firehose 串流和 S3 儲存貯體，它們必須已存在。如需稽核問題清單報告的範例，請參閱 [稽核問題清單報告](mask-sensitive-log-data-audit-findings.md)。
+ 第二個區塊必須同時包含 `DataIdentifer` 陣列和具有 `Deidentify` 動作的 `Operation` 屬性。`DataIdentifer` 陣列必須與政策第一個區塊中的 `DataIdentifer` 陣列完全一致。

  具有 `Deidentify` 動作的 `Operation` 屬性用於實際遮罩資料，其必須包含 ` "MaskConfig": {}` 物件。` "MaskConfig": {}` 物件必須是空的。

以下是僅使用受管資料識別符的資料保護政策範例。此政策會遮罩電子郵件地址和美國駕照。

如需指定自訂資料識別符的政策相關資訊，請參閱 [在您的資料保護政策中使用自訂資料識別符](CWL-custom-data-identifiers.md#using-custom-data-identifiers)。

```
{
    "Name": "data-protection-policy",
    "Description": "test description",
    "Version": "2021-06-01",
    "Statement": [{
            "Sid": "audit-policy",
            "DataIdentifier": [
                "arn:aws:dataprotection::aws:data-identifier/EmailAddress",
                "arn:aws:dataprotection::aws:data-identifier/DriversLicense-US"
            ],
            "Operation": {
                "Audit": {
                    "FindingsDestination": {
                        "CloudWatchLogs": {
                            "LogGroup": "EXISTING_LOG_GROUP_IN_YOUR_ACCOUNT,"
                        },
                        "Firehose": {
                            "DeliveryStream": "EXISTING_STREAM_IN_YOUR_ACCOUNT"
                        },
                        "S3": {
                            "Bucket": "EXISTING_BUCKET"
                        }
                    }
                }
            }
        },
        {
            "Sid": "redact-policy",
            "DataIdentifier": [
                "arn:aws:dataprotection::aws:data-identifier/EmailAddress",
                "arn:aws:dataprotection::aws:data-identifier/DriversLicense-US"
            ],
            "Operation": {
                "Deidentify": {
                    "MaskConfig": {}
                }
            }
        }
    ]
}
```

# 建立單一日誌群組的資料保護政策
<a name="mask-sensitive-log-data-start"></a>

您可以使用 CloudWatch Logs 主控台或 AWS CLI 命令建立資料保護政策來遮罩敏感資料。

您可以為每個日誌群組指派一個資料保護政策。每個資料保護政策都可以稽核多種類型的資訊。每個資料保護政策都可以包含一份稽核聲明。

**Topics**
+ [主控台](#mask-sensitive-log-data-start-console)
+ [AWS CLI](#mask-sensitive-log-data-start-cli)

## 主控台
<a name="mask-sensitive-log-data-start-console"></a>

**若要使用主控台建立資料保護政策**

1. 透過 [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 開啟 CloudWatch 主控台。

1.  在導覽窗格中依序選擇 **Logs** (日誌)、**Log groups** (日誌群組)。

1. 選擇日誌群組的名稱。

1. 選擇 **Actions** (動作)、**Create data protection policy** (建立資料保護政策)。

1. 針對**受管資料識別符**，選取您要在此日誌群組中稽核和遮罩的資料類型。您可以在選取方塊中輸入內容以尋找所需的識別符。

   我們建議您只選取與日誌資料和業務相關的資料識別符。選擇的資料類型過多可能會導致誤報。

   如需您可以使用受管資料識別符保護哪些資料類型的詳細資訊，請參閱 [您可以保護的資料類型](protect-sensitive-log-data-types.md)。

1. （選用） 如果您想要使用自訂資料識別符稽核和遮罩其他類型的資料，請選擇**新增自訂資料識別**符。然後輸入資料類型的名稱，以及用來在日誌事件中搜尋該資料類型的規則表達式。如需詳細資訊，請參閱[自訂資料識別符](CWL-custom-data-identifiers.md)。

   單一資料保護政策最多可包含 10 個自訂資料識別符。每個定義自訂資料識別符的規則表達式都必須為 200 個字元或更少。

1. (選用) 選擇向其傳送稽核問題清單的一或多個服務。即使您選擇不將稽核問題清單傳送至任何這些服務，系統仍然會遮罩您選取的敏感資料類型。

1. 選擇 **Activate data protection** (啟動資料保護)。

## AWS CLI
<a name="mask-sensitive-log-data-start-cli"></a>

**使用 AWS CLI 建立資料保護政策**

1. 使用文字編輯器來建立名為 `DataProtectionPolicy.json` 的政策檔案。如需有關政策語法的資訊，請參閱下一節。

1. 輸入以下命令：

   ```
   aws logs put-data-protection-policy --log-group-identifier "my-log-group" --policy-document file:///Path/DataProtectionPolicy.json --region us-west-2
   ```

### AWS CLI 或 API 操作的資料保護政策語法
<a name="mask-sensitive-log-data-policysyntax"></a>

當您建立要在 AWS CLI 命令或 API 操作中使用的 JSON 資料保護政策時，該政策必須包含兩個 JSON 區塊：
+ 第一個區塊必須同時包含 `DataIdentifer` 陣列和具有 `Audit` 動作的 `Operation` 屬性。`DataIdentifer` 陣列會列出您要遮罩的敏感資料類型。如需所有可用選項的詳細資訊，請參閱[您可以保護的資料類型](protect-sensitive-log-data-types.md)。

  具有 `Audit` 動作的 `Operation` 屬性為必要項目，如此才能找到敏感資料術語。此 `Audit` 動作必須包含 `FindingsDestination` 物件。您可以選擇使用此 `FindingsDestination` 物件，來列出要向其傳送稽核問題清單報告的一或多個目的地。如果您指定目標，例如日誌群組、Amazon Data Firehose 串流和 S3 儲存貯體，它們必須已存在。如需稽核問題清單報告的範例，請參閱 [稽核問題清單報告](mask-sensitive-log-data-audit-findings.md)。
+ 第二個區塊必須同時包含 `DataIdentifer` 陣列和具有 `Deidentify` 動作的 `Operation` 屬性。`DataIdentifer` 陣列必須與政策第一個區塊中的 `DataIdentifer` 陣列完全一致。

  具有 `Deidentify` 動作的 `Operation` 屬性用於實際遮罩資料，其必須包含 ` "MaskConfig": {}` 物件。` "MaskConfig": {}` 物件必須是空的。

以下是遮罩電子郵件地址和美國駕照的資料保護政策範例。

```
{
    "Name": "data-protection-policy",
    "Description": "test description",
    "Version": "2021-06-01",
    "Statement": [{
            "Sid": "audit-policy",
            "DataIdentifier": [
                "arn:aws:dataprotection::aws:data-identifier/EmailAddress",
                "arn:aws:dataprotection::aws:data-identifier/DriversLicense-US"
            ],
            "Operation": {
                "Audit": {
                    "FindingsDestination": {
                        "CloudWatchLogs": {
                            "LogGroup": "EXISTING_LOG_GROUP_IN_YOUR_ACCOUNT,"
                        },
                        "Firehose": {
                            "DeliveryStream": "EXISTING_STREAM_IN_YOUR_ACCOUNT"
                        },
                        "S3": {
                            "Bucket": "EXISTING_BUCKET"
                        }
                    }
                }
            }
        },
        {
            "Sid": "redact-policy",
            "DataIdentifier": [
                "arn:aws:dataprotection::aws:data-identifier/EmailAddress",
                "arn:aws:dataprotection::aws:data-identifier/DriversLicense-US"
            ],
            "Operation": {
                "Deidentify": {
                    "MaskConfig": {}
                }
            }
        }
    ]
}
```

# 檢視未遮罩的資料
<a name="mask-sensitive-log-data-viewunmasked"></a>

若要檢視未遮罩的資料，使用者必須具有 `logs:Unmask` 許可。具有此許可的使用者可透過以下方式查看未遮罩的資料：
+ 檢視日誌串流中的事件時，選擇 **Display** (顯示)、**Unmask** (解除遮罩)。
+ 使用包含 **unmask(@message)** 命令的 CloudWatch Logs Insights 查詢。下列範例查詢會以未遮罩的方式顯示串流中最近 20 個日誌事件：

  ```
  fields @timestamp, @message, unmask(@message)
  | sort @timestamp desc
  | limit 20
  ```

  如需有關 CloudWatch Logs Insights 命令的詳細資訊，請參閱 [CloudWatch Logs Insights 語言查詢語法](CWL_QuerySyntax.md)。
+ 搭配 `unmask` 參數使用 [GetLogEvents](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogEvents.html) 或 [FilterLogEvents](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_FilterLogEvents.html) 操作。

**CloudWatchLogsFullAccess** 政策包含 `logs:Unmask` 許可。若要將 `logs:Unmask` 授予給不具備 **CloudWatchLogsFullAccess** 許可的使用者，您可以將自訂 IAM 政策附加到該使用者。如需詳細資訊，請參閱[新增許可到使用者 (主控台)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_change-permissions.html#users_change_permissions-add-console)。

# 稽核問題清單報告
<a name="mask-sensitive-log-data-audit-findings"></a>

如果您設定 CloudWatch Logs 資料保護稽核政策，將稽核報告寫入 CloudWatch Logs、Amazon S3 或 Firehose，這些調查結果報告類似於下列範例。CloudWatch Logs 會針對每個包含敏感資料的日誌事件寫入一份問題清單報告。

```
{
    "auditTimestamp": "2023-01-23T21:11:20Z",
    "resourceArn": "arn:aws:logs:us-west-2:111122223333:log-group:/aws/lambda/MyLogGroup:*",
    "dataIdentifiers": [
        {
            "name": "EmailAddress",
            "count": 2,
            "detections": [
                {
                    "start": 13,
                    "end": 26
                },
{
                    "start": 30,
                    "end": 43
                }
            ]
        }
    ]
}
```

報告中的欄位如下所示：
+ `resourceArn` 欄位會顯示在其中找到敏感資料的日誌群組。
+ `dataIdentifiers` 物件會顯示您正在稽核的某種敏感資料的問題清單相關資訊。
+ `name` 欄位可識別此區段所報告的敏感資料類型。
+ `count` 欄位會顯示此種敏感資料在日誌事件中出現的次數。
+ `start` 和 `end` 欄位會依字元計數顯示日誌事件中每次出現敏感資料的位置。

上一個範例顯示在一個日誌事件中尋找兩個電子郵件地址的報告。第一個電子郵件地址從日誌事件的第 13 個字元開始，並在第 26 個字元處結束。第二個電子郵件地址從第 30 個字元一直到第 43 個字元。即使此日誌事件有兩個電子郵件地址，`LogEventsWithFindings` 指標的值也只會遞增 1，因為該指標會對包含敏感資料的日誌事件計數，而非計算敏感資料的出現次數。

## 將稽核問題清單傳送至受 保護的 儲存貯體所需的金鑰政策 AWS KMS
<a name="mask-sensitive-log-data-audit-findings-kms"></a>

透過啟用採用 Amazon S3 受管金鑰 (SSE-S3) 的伺服器端加密或採用 KMS 金鑰 (SSE-KMS) 的伺服器端加密，您可以保護 Amazon S3 儲存貯體中的資料。如需詳細資訊，請參閱《Amazon S3 使用者指南》中的[使用伺服器端加密保護資料](https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html)。

如果您將稽核調查結果發送至以 SSE-S3 保護的儲存貯體，則不需要其他組態。Amazon S3 會處理加密金鑰。

如果您將稽核調查結果發送至以 SSE-KMS 保護的儲存貯體，您必須更新 KMS 金鑰的金鑰政策，讓日誌傳遞帳戶能夠寫入您的 S3 儲存貯體。如需使用 SSE-KMS 所需之金鑰政策的詳細資訊，請參閱《Amazon CloudWatch Logs 使用者指南》中的 [Amazon S3 儲存貯體伺服器端加密](AWS-logs-infrastructure-S3.md#AWS-logs-SSE-KMS-S3)。

# 您可以保護的資料類型
<a name="protect-sensitive-log-data-types"></a>

本節包含有關您可以在 CloudWatch Logs 資料保護政策中保護的資料類型的資訊。CloudWatch Logs 受管資料識別符提供預先設定的資料類型，以保護財務資料、個人健康資訊 (PHI) 和個人身分識別資訊 (PII)。您也可以使用自訂資料識別符來建立針對特定使用案例量身打造的資料識別符。

**Contents**
+ [適用於敏感資料類型的 CloudWatch Logs 受管資料識別符](CWL-managed-data-identifiers.md)
  + [憑證](protect-sensitive-log-data-types-credentials.md)
    + [憑證資料類型的資料識別符 ARN](protect-sensitive-log-data-types-credentials.md#cwl-data-protection-credentials-arns)
  + [裝置識別符](protect-sensitive-log-data-types-device.md)
    + [裝置資料類型的資料識別符 ARN](protect-sensitive-log-data-types-device.md#cwl-data-protection-devices-arns)
  + [財務資訊](protect-sensitive-log-data-types-financial.md)
    + [財務資料類型的資料識別符 ARN](protect-sensitive-log-data-types-financial.md#cwl-data-protection-financial-arns)
  + [受保護醫療資訊 (PHI)](protect-sensitive-log-data-types-health.md)
    + [受保護醫療資訊 (PHI) 資料類型的資料識別符 ARN](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) 的資料識別符 ARN](protect-sensitive-log-data-types-pii.md#CWL-data-protection-pii-arns)
+ [自訂資料識別符](CWL-custom-data-identifiers.md)
  + [什麼是 SNS 自訂資料識別符？](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)

# 適用於敏感資料類型的 CloudWatch Logs 受管資料識別符
<a name="CWL-managed-data-identifiers"></a>

本節包含您可以使用受管資料識別符保護的資料類型，以及哪些國家和區域與每種資料類型相關的相關資訊。

對於某些類型的敏感資料，CloudWatch Logs 資料保護功能會掃描資料相鄰的關鍵字，並僅在找到該關鍵字時確定尋找到相符項目。如果關鍵字必須接近特定類型的資料，則關鍵字通常必須在資料的 30 個字元 （包含） 內。

如果關鍵字包含空格，CloudWatch Logs 資料保護功能會自動比對缺少空格，或包含底線 (`_`) 或連字號 (`-`) (而非空格) 的關鍵字變化。在某些情況下，CloudWatch Logs 還會擴展或縮寫關鍵字，以因應關鍵字的常見變化。

下表列出 CloudWatch Logs 可以使用受管資料識別符偵測的憑證、裝置、財務、醫療和受保護醫療資訊 (PHI) 類型。這些是某些資料類型的個人身分識別資訊 (PII) 等資料。

**支援的識別符 (與語言和區域無關)**


| 識別符 | Category | 
| --- | --- | 
|  `Address`  |  個人  | 
|  `AwsSecretKey`  |  憑證  | 
|  `CreditCardExpiration`  |  金融  | 
|  `CreditCardNumber`  |  金融  | 
|  `CreditCardSecurityCode`  |  金融  | 
|  `EmailAddress`  |  個人  | 
|  `IpAddress`  |  個人  | 
|  `LatLong`  |  個人  | 
|  `Name`  |  個人  | 
|  `OpenSshPrivateKey`  |  憑證  | 
|  `PgpPrivateKey`  |  憑證  | 
|  `PkcsPrivateKey`  |  憑證  | 
|  `PuttyPrivateKey`  |  憑證  | 
|  `VehicleIdentificationNumber`  |  個人  | 

與區域相關的資料識別符需要包含識別符名稱、一個連字號，以及兩個字母 (ISO 3166-1 alpha-2) 代碼。例如 `DriversLicense-US`。

**支援的識別符 (必須包含兩個字母的國家或地區碼)**


| 識別符 | Category | 國家/地區與語言 | 
| --- | --- | --- | 
| BankAccountNumber | 金融 |  DE、ES、FR、GB、IT、US  | 
|  CepCode  |  個人  |  BR  | 
|  Cnpj  |  個人  |  BR  | 
|  CpfCode  |  個人  |  BR  | 
|  DriversLicense  |  個人  |  AT、AU、BE、BG、CA、CY、CZ、DE、DK、EE、ES、FI、FR、GB、GR、HR、HU、IE、IT、LT、LU、LV、MT、NL、PL、PT、RO、SE、SI、SK、US  | 
|  DrugEnforcementAgencyNumber  |  運作狀態  |  US  | 
|  ElectoralRollNumber  |  個人  |  GB  | 
|  HealthInsuranceCardNumber  |  運作狀態  |  歐盟  | 
|  HealthInsuranceClaimNumber  |  運作狀態  |  US  | 
|  HealthInsuranceNumber  |  運作狀態  |  法國  | 
|  HealthcareProcedureCode  |  運作狀態  |  US  | 
|  IndividualTaxIdentificationNumber  |  個人  |  美國  | 
|  InseeCode  |  個人  |  法國  | 
|  MedicareBeneficiaryNumber  |  運作狀態  |  US  | 
|  NationalDrugCode  |  運作狀態  |  US  | 
|  NationalIdentificationNumber  |  個人  |  DE、ES、IT  | 
|  NationalInsuranceNumber  |  個人  |  GB  | 
|  NationalProviderId  |  運作狀態  |  US  | 
|  NhsNumber  |  運作狀態  |  GB  | 
|  Nienumber  |  個人  |  ES  | 
|  NifNumber  |  個人  |  ES  | 
|  PassportNumber  |  個人  |  CA、DE、ES、FR、GB、IT、US  | 
|  PermanentResidenceNumber  |  個人  |  CA  | 
|  PersonalHealthNumber  |  醫療保健  |  CA  | 
|  PhoneNumber  |  個人  |  BR、DE、ES、FR、GB、IT、US  | 
|  PostalCode  |  個人  |  CA  | 
|  RgNumber  |  個人  |  BR  | 
|  SocialInsuranceNumber  |  個人  |  CA  | 
|  Ssn  |  個人  |  ES、US  | 
|  TaxId  |  個人  |  DE、ES、FR、GB  | 
|  ZipCode  |  個人  |  美國  | 

# 憑證
<a name="protect-sensitive-log-data-types-credentials"></a>

CloudWatch Logs 資料保護功能可以找到下列類型的憑證。


| 資料類型 | 資料識別符 ID | 必要的關鍵字 | 國家和地區 | 
| --- | --- | --- | --- | 
|  AWS 私密存取金鑰 |  `AwsSecretKey`  |  `aws_secret_access_key`, `credentials`, `secret access key`, `secret key`, `set-awscredential`  |  全部  | 
|  OpenSSH 私密金鑰 |  `OpenSSHPrivateKey`  |  無  |  全部  | 
|  PGP 私密金鑰 |  `PgpPrivateKey`  |  無  |  全部  | 
|  Pkcs 私有金鑰 |  `PkcsPrivateKey` |  無  |  全部  | 
|  PuTTY 私密金鑰 |  `PuttyPrivateKey` |  無  |  全部  | 

## 憑證資料類型的資料識別符 ARN
<a name="cwl-data-protection-credentials-arns"></a>

以下列出您可新增至資料保護政策的資料識別符 Amazon Resource Name (ARN)。


| 憑證資料識別符 ARN | 
| --- | 
| arn:aws:dataprotection::aws:data-identifier/AwsSecretKey | 
| arn:aws:dataprotection::aws:data-identifier/OpenSshPrivateKey | 
| arn:aws:dataprotection::aws:data-identifier/PgpPrivateKey | 
| arn:aws:dataprotection::aws:data-identifier/PkcsPrivateKey | 
| arn:aws:dataprotection::aws:data-identifier/PuttyPrivateKey | 

# 裝置識別符
<a name="protect-sensitive-log-data-types-device"></a>

CloudWatch Logs 資料保護功能可以找到下列類型的裝置識別符。


| 資料類型 | 資料識別符 ID | 必要的關鍵字 | 國家和地區 | 
| --- | --- | --- | --- | 
|  IP 位址 |  `IpAddress`  |  無  |  全部  | 

## 裝置資料類型的資料識別符 ARN
<a name="cwl-data-protection-devices-arns"></a>

以下列出您可新增至資料保護政策的資料識別符 Amazon Resource Name (ARN)。


| 裝置資料識別符 ARN | 
| --- | 
| arn:aws:dataprotection::aws:data-identifier/IpAddress | 

# 財務資訊
<a name="protect-sensitive-log-data-types-financial"></a>

CloudWatch Logs 資料保護功能可以找到下列類型的財務資訊。

如果您設定了資料保護政策，則無論日誌群組所在的地理位置為何，CloudWatch Logs 都會掃描您指定的資料識別符。此資料表中**國家與地區**資料欄中的資訊指出，是否必須在資料識別符後附加兩個字母的國家/地區碼，以偵測這些國家和地區的相應關鍵字。


| 資料類型 | 資料識別符 ID | 必要的關鍵字 | 國家和地區 | 備註 | 
| --- | --- | --- | --- | --- | 
|  銀行帳戶號碼 |  `BankAccountNumber`  |  是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**銀行帳戶號碼的關鍵字**資料表。  |  法國、德國、義大利、西班牙、英國、美國  | 包含最多由 34 個英數字元組成的國際銀行帳號 (IBANs)，包括國家/地區代碼等元素。 | 
|  信用卡到期日 |  `CreditCardExpiration`  |  `exp d`, `exp m`, `exp y`, `expiration`, `expiry`  |  全部  |  | 
|  信用卡號碼 |  `CreditCardNumber`  |  `account number`, `american express`, `amex`, `bank card`, `card`, `card number`, `card num`, `cc #`, `ccn`, `check card`, `credit`, `credit card#`, `dankort`, `debit`, `debit card`, `diners club`, `discover`, `electron`, `japanese card bureau`, `jcb`, `mastercard`, `mc`, `pan`, `payment account number`, `payment card number`, `pcn`, `union pay`, `visa`  |  全部  | 偵測要求資料是符合 Luhn 檢查公式的 13-19 位數序列，並針對以下任何類型的信用卡使用標準卡號字首：American Express、Dankort、Diner’s Club、Discover、Electron、Japanese Card Bureau (JCB)、Mastercard、UnionPay 和 Visa。 | 
|  信用卡驗證碼 |  `CreditCardSecurityCode`  |  `card id`, `card identification code`, `card identification number`, `card security code`, `card validation code`, `card validation number`, `card verification data`, `card verification value`, `cvc`, `cvc2`, `cvv`, `cvv2`, `elo verification code`  |  全部  |  | 

**銀行帳戶號碼的關鍵字**

使用下列關鍵字處理銀行帳戶號碼。這包括國際銀行帳號 (IBANs)，最多可包含 34 個英數字元，包括國家/地區代碼等元素。


| Country | 關鍵字 | 
| --- | --- | 
|  法國 |  `account code`, `account number`, `accountno#`, `accountnumber#`, `bban`, `code bancaire`, `compte bancaire`, `customer account id`, `customer account number`, `customer bank account id`, `iban`, `numéro de compte`  | 
|  德國 |  `account code`, `account number`, `accountno#`, `accountnumber#`, `bankleitzahl`, `bban`, `customer account id`, `customer account number`, `customer bank account id`, `geheimzahl`, `iban`, `kartennummer`, `kontonummer`, `kreditkartennummer`, `sepa`  | 
|  義大利 |  `account code`, `account number`, `accountno#`, `accountnumber#`, `bban`, `codice bancario`, `conto bancario`, `customer account id`, `customer account number`, `customer bank account id`, `iban`, `numero di conto`  | 
|  西班牙 |  `account code`, `account number`, `accountno#`, `accountnumber#`, `bban`, `código cuenta`, `código cuenta bancaria`, `cuenta cliente id`, `customer account ID`, `customer account number`, `customer bank account id`, `iban`, `número cuenta bancaria cliente`, `número cuenta cliente`  | 
|  英國 |  `account code`, `account number`, `accountno#`, `accountnumber#`, `bban`, `customer account ID`, `customer account number`, `customer bank account id`, `iban`, `sepa`  | 
|  美國 |  `bank account`, `bank acct`, `checking account`, `checking acct`, `deposit account`, `deposit acct`, `savings account`, `savings acct`, `chequing account`, `chequing acct`  | 

CloudWatch Logs 不會報告出現的以下序列，信用卡發卡機構已保留這些序列供公開測試使用。

```
122000000000003, 2222405343248877, 2222990905257051, 2223007648726984, 2223577120017656, 
30569309025904, 34343434343434, 3528000700000000, 3530111333300000, 3566002020360505, 36148900647913, 
36700102000000, 371449635398431, 378282246310005, 378734493671000, 38520000023237, 4012888888881881, 
4111111111111111, 4222222222222, 4444333322221111, 4462030000000000, 4484070000000000, 4911830000000, 
4917300800000000, 4917610000000000, 4917610000000000003, 5019717010103742, 5105105105105100, 
5111010030175156, 5185540810000019, 5200828282828210, 5204230080000017, 5204740009900014, 5420923878724339, 
5454545454545454, 5455330760000018, 5506900490000436, 5506900490000444, 5506900510000234, 5506920809243667, 
5506922400634930, 5506927427317625, 5553042241984105, 5555553753048194, 5555555555554444, 5610591081018250, 
6011000990139424, 6011000400000000, 6011111111111117, 630490017740292441, 630495060000000000, 
6331101999990016, 6759649826438453, 6799990100000000019, and 76009244561.
```

## 財務資料類型的資料識別符 ARN
<a name="cwl-data-protection-financial-arns"></a>

以下列出您可新增至資料保護政策的資料識別符 Amazon Resource Name (ARN)。


| 財務資料識別符 ARN | 
| --- | 
| arn:aws:dataprotection::aws:data-identifier/BankAccountNumber-DE | 
| arn:aws:dataprotection::aws:data-identifier/BankAccountNumber-ES | 
| arn:aws:dataprotection::aws:data-identifier/BankAccountNumber-FR | 
| arn:aws:dataprotection::aws:data-identifier/BankAccountNumber-GB | 
| arn:aws:dataprotection::aws:data-identifier/BankAccountNumber-IT | 
| arn:aws:dataprotection::aws:data-identifier/BankAccountNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/CreditCardExpiration | 
| arn:aws:dataprotection::aws:data-identifier/CreditCardNumber | 
| arn:aws:dataprotection::aws:data-identifier/CreditCardSecurityCode | 

# 受保護醫療資訊 (PHI)
<a name="protect-sensitive-log-data-types-health"></a>

CloudWatch Logs 資料保護功能可以找到下列類型的受保護醫療資訊 (PHI)。

如果您設定了資料保護政策，則無論日誌群組所在的地理位置為何，CloudWatch Logs 都會掃描您指定的資料識別符。此資料表中**國家與地區**資料欄中的資訊指出，是否必須在資料識別符後附加兩個字母的國家/地區碼，以偵測這些國家和地區的相應關鍵字。


| 資料類型 | 資料識別符 ID | 必要的關鍵字 | 國家和地區 | 
| --- | --- | --- | --- | 
|  緝毒署 (DEA) 註冊號碼 |  `DrugEnforcementAgencyNumber`  |  `dea number`, `dea registration`  |  美國  | 
|  健康保險卡號碼 (EHIC) |  `HealthInsuranceCardNumber`  |  `assicurazione sanitaria numero`, `carta assicurazione numero`, `carte d’assurance maladie`, `carte européenne d'assurance maladie`, `ceam`, `ehic`, `ehic#`, `finlandehicnumber#`, `gesundheitskarte`, `hälsokort`, `health card`, `health card number`, `health insurance card`, `health insurance number`, `insurance card number`, `krankenversicherungskarte`, `krankenversicherungsnummer`, `medical account number`, `numero conto medico`, `numéro d’assurance maladie`, `numéro de carte d’assurance`, `numéro de compte medical`, `número de cuenta médica`, `número de seguro de salud`, `número de tarjeta de seguro`, `sairaanhoitokortin`, `sairausvakuutuskortti`, `sairausvakuutusnumero`, `sjukförsäkring nummer`, `sjukförsäkringskort`, `suomi ehic-numero`, `tarjeta de salud`, `terveyskortti`, `tessera sanitaria assicurazione numero`, `versicherungsnummer`  |  歐盟  | 
|  健康保險索償編碼 (HICN) |  `HealthInsuranceClaimNumber`  |  `health insurance claim number`, `hic no`, `hic no.`, `hic number`, `hic#`, `hicn`, `hicn#`, `hicno#`  |  美國  | 
|  健康保險或醫療識別號碼 |  `HealthInsuranceNumber`  |  `carte d'assuré social`, `carte vitale`, `insurance card`   |  法國  | 
|  醫療保健通用程序編碼系統 (HCPCS) 代碼 |  `HealthcareProcedureCode` |  `current procedural terminology`, `hcpcs`, `healthcare common procedure coding system`   |  美國  | 
|  聯邦醫療保險受益人號碼 (MBN) |  `MedicareBeneficiaryNumber` |  `mbi`, `medicare beneficiary`  |  美國  | 
|  國家藥物法規 (NDC) |  `NationalDrugCode` |  `national drug code`, `ndc`  |  美國  | 
|  國家提供者識別符 (NPI) |  `NationalProviderId` |  `hipaa`, `n.p.i.`, `national provider`, `npi`  |  美國  | 
|  國民保健署 (NHS) 號碼 |  `NhsNumber` |  `national health service`, `NHS`  |  英國  | 
|  個人健康號碼 |  `PersonalHealthNumber` |  `canada healthcare number`, `msp number`, `care number`, `phn`, `soins de santé`   |  加拿大  | 

## 受保護醫療資訊 (PHI) 資料類型的資料識別符 ARN
<a name="cwl-data-protection-phi-arns"></a>

以下列出可用於受保護醫療資訊 (PHI) 資料保護政策的資料識別符 Amazon Resource Name (ARN)。


| PHI 資料識別符 ARN | 
| --- | 
| arn:aws:dataprotection::aws:data-identifier/DrugEnforcementAgencyNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/HealthcareProcedureCode-US | 
| arn:aws:dataprotection::aws:data-identifier/HealthInsuranceCardNumber-EU | 
| arn:aws:dataprotection::aws:data-identifier/HealthInsuranceClaimNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/HealthInsuranceNumber-FR | 
| arn:aws:dataprotection::aws:data-identifier/MedicareBeneficiaryNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/NationalDrugCode-US | 
| arn:aws:dataprotection::aws:data-identifier/NationalInsuranceNumber-GB | 
| arn:aws:dataprotection::aws:data-identifier/NationalProviderId-US | 
| arn:aws:dataprotection::aws:data-identifier/NhsNumber-GB | 
| arn:aws:dataprotection::aws:data-identifier/PersonalHealthNumber-CA | 

# 個人身分識別資訊 (PII)
<a name="protect-sensitive-log-data-types-pii"></a>

CloudWatch Logs 資料保護功能可以找到下列類型的個人身分識別資訊 (PII)。

如果您設定了資料保護政策，則無論日誌群組所在的地理位置為何，CloudWatch Logs 都會掃描您指定的資料識別符。此資料表中**國家與地區**資料欄中的資訊指出，是否必須在資料識別符後附加兩個字母的國家/地區碼，以偵測這些國家和地區的相應關鍵字。


| 資料類型 | 資料識別符 ID | 必要的關鍵字 | 國家和地區 | 備註 | 
| --- | --- | --- | --- | --- | 
|  出生日期 |  `DateOfBirth`  |  `dob`, `date of birth`, `birthdate`, `birth date`, `birthday`, `b-day`, `bday`  |  任何  | 支援大多數日期格式，例如所有數字以及數字和月份名稱的組合。您可以用空格、斜線 (/) 或連字號 (‐) 分隔日期組成部分。 | 
|  Código de Endereçamento Postal (CEP) |  `CepCode`  |  `cep`, `código de endereçamento postal`, `codigo de endereçamento postal`  |  巴西  |  | 
|  Cadastro Nacional da Pessoa Jurídica (CNPJ) |  `Cnpj`  |  `cadastro nacional da pessoa jurídica`, `cadastro nacional da pessoa juridica`, `cnpj`  |  巴西  |  | 
|  Cadastro de Pessoas Físicas (CPF) |  `CpfCode`  |  `Cadastro de pessoas fisicas`, `cadastro de pessoas físicas`, `cadastro de pessoa física`, `cadastro de pessoa fisica`, `cpf`  |  巴西  |  | 
|  駕照識別號碼 |  `DriversLicense`  |  是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**駕照識別號碼**資料表。  |  許多國家/地區。如需詳細資訊，請參閱**駕照識別號碼**資料表。  |  | 
|  選民名冊號碼 |  `ElectoralRollNumber`  |  `electoral #`, `electoral number`, `electoral roll #`, `electoral roll no.`, `electoral roll number`, `electoralrollno`  |  英國  |  | 
|  個人納稅識別號碼 |  `IndividualTaxIdenticationNumber`  |  是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**個人納稅人識別號碼**資料表。  |  巴西、法國、德國、西班牙、英國  |  | 
|  國家統計和經濟研究所 (INSEE) |  `InseeCode`  |  是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**國民身分證號碼的關鍵字**資料表。  |  法國  |  | 
|  國民身分證號碼 |  `NationalIdentificationNumber`  |  是。如需詳細資訊，請參閱本節後文的**國民身分證號碼的關鍵字**資料表。  |  德國、義大利、西班牙  | 這包括 Documento Nacional de Identidad (DNI) 識別符 (西班牙)、Codice fiscale codes (義大利) 和國民身分證號碼 (德國)。 | 
| 國民保險號碼 (NINO) |  `NationalInsuranceNumber`  | insurance no., insurance number,  insurance\$1, national insurance number, nationalinsurance\$1, nationalinsurancenumber, nin, nino | 英國 | – | 
| Número de identidad de extranjero (NIE) |  `NieNumber`  | 是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**個人納稅人識別號碼**資料表。 | 西班牙 |  | 
| Número de Identificación Fiscal (NIF) |  `NifNumber`  | 是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**個人納稅人識別號碼**資料表。 | 西班牙 |  | 
| 護照號碼 |  `PassportNumber`  | 是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**護照號碼的關鍵字**資料表。 | 加拿大、法國、德國、義大利、西班牙、英國、美國 |  | 
| 永久居留號碼 |  `PermanentResidenceNumber`  | carte résident permanent, numéro carte résident permanent, numéro résident permanent, permanent resident card, permanent resident card number, permanent resident no,  permanent resident no., permanent resident number, pr no, pr no., pr non, pr number, résident permanent no., résident permanent non | 加拿大 |  | 
| 電話號碼 |  `PhoneNumber`  |  巴西：關鍵字還包括：`cel`、`celular`、`fone`、`móvel`、`número residencial`、`numero residencial`、`telefone` 其他：`cell`、`contact`、`fax`、`fax number`、`mobile`、`phone`、`phone number`、`tel`、`telephone`、`telephone number`  | 巴西、加拿大、法國、德國、義大利、西班牙、英國、美國 | 這包括美國免付費電話號碼和傳真號碼。如果關鍵字與資料相鄰，則該號碼不必包含國家/地區代碼。如果關鍵字不在資料附近，則該數字必須包含國家/地區代碼。 | 
| 郵遞區號 |  `PostalCode`  | 無 | 加拿大 |  | 
| Registro Geral (RG) |  `RgNumber`  | 是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**個人納稅人識別號碼**資料表。 | 巴西 |  | 
| 社會保險號碼 (SIN) |  `SocialInsuranceNumber`  | canadian id, numéro d'assurance sociale, social insurance number, sin | 加拿大 |  | 
| 社會安全號碼 (SSN) |  `Ssn`  | 西班牙 – `número de la seguridad social`、`social security no.`、`social security no`、`número de la seguridad social`、`social security number`、`socialsecurityno#`、`ssn`、`ssn#` 美國 – `social security`、`ss#`、`ssn`  | 西班牙、美國 |  | 
| 納稅識別號碼或參考號碼 |  `TaxId`  | 是。不同的關鍵字適用於不同的國家/地區。如需詳細資訊，請參閱本節後文的**個人納稅人識別號碼**資料表。. | 法國、德國、西班牙、英國 | 這包括 TIN (法國)；Steueridentifikationsnummer (德國)；CIF (西班牙)；以及 TRN、UTR (英國)。 | 
| 郵遞區號 |  `ZipCode`  | zip code, zip\$14 | 美國 | 美國郵遞區號。 | 
| 郵寄地址 |  `Address`  | 無 | 澳洲、加拿大、法國、德國、義大利、西班牙、英國、美國 | 雖然不需要使用關鍵字，但偵測需要地址中包含城市或地點的名稱以及郵遞區號。 | 
| 電子郵件地址 |  `EmailAddress`  | 無 | 任何 |  | 
| 全球定位系統 (GPS) 座標 |  `LatLong`  | coordinate, coordinates, lat long,  latitude longitude, location, position | 任何 | 如果緯度和經度座標以一對形式儲存，且使用十進位度 (DD) 格式 (例如 41.948614,-87.655311)，CloudWatch Logs 就可以偵測 GPS 座標。支援不包括度數十進位分鐘 (DDM) 格式的座標 (例如 41°56.9168'N 87°39.3187'W) 或度、分、秒 (DMS) 格式 (例如 41°56'55.0104"N 87°39'19.1196"W)。 | 
| 全名 |  `Name`  | 無 | 任何 | CloudWatch Logs 只能偵測全名。支援僅限於拉丁字元集。 | 
| 車輛識別符 (VIN) |  `VehicleIdentificationNumber`  | Fahrgestellnummer, niv, numarul de identificare, numarul seriei de sasiu, serie sasiu, numer VIN, Número de Identificação do Veículo,  Número de Identificación de Automóviles, numéro d'identification du véhicule, vehicle identification number, vin, VIN numeris | 任何 | CloudWatch Logs 可以偵測包含 17 個字元序列並符合 ISO 3779 和 3780 標準的 VIN。這些標準是專為全球使用而設計的。 | 

## 駕照識別號碼的關鍵字
<a name="CWL-managed-data-identifiers-pii-dl-keywords"></a>

為了偵測各種類型的駕照識別號碼，CloudWatch Logs 要求關鍵字與這些號碼相鄰。下表列出 CloudWatch Logs 可辨識的特定國家和地區的關鍵字。


| 國家/地區或區域 | 關鍵字 | 
| --- | --- | 
| 澳洲 | dl\$1 dl:, dl :, dlno\$1 driver licence, driver license, driver permit, drivers lic., drivers licence, driver's licence, drivers license, driver's license, drivers permit, driver's permit, drivers permit number, driving licence, driving license, driving permit | 
| 奧地利 | führerschein, fuhrerschein, führerschein republik österreich, fuhrerschein republik osterreich | 
| 比利時 | fuehrerschein, fuehrerschein- nr, fuehrerscheinnummer, fuhrerschein, führerschein, fuhrerschein- nr, führerschein- nr, fuhrerscheinnummer, führerscheinnummer, numéro permis conduire, permis de conduire, rijbewijs, rijbewijsnummer | 
| 保加利亞 | превозно средство, свидетелство за управление на моторно, свидетелство за управление на мпс, сумпс, шофьорска книжка | 
| 加拿大 | dl\$1, dl:, dlno\$1, driver licence, driver licences, driver license, driver licenses, driver permit, drivers lic., drivers licence, driver's licence, drivers licences, driver's licences, drivers license, driver's license, drivers licenses, driver's licenses, drivers permit, driver's permit, drivers permit number, driving licence, driving license, driving permit, permis de conduire | 
| 克羅埃西亞 | vozačka dozvola | 
| 賽普勒斯 | άδεια οδήγησης | 
| 捷克 | číslo licence, císlo licence řidiče, číslo řidičského průkazu, ovladače lic., povolení k jízdě, povolení řidiče, řidiči povolení, řidičský prúkaz, řidičský průkaz | 
| 丹麥 | kørekort, kørekortnummer | 
| 愛沙尼亞 | juhi litsentsi number, juhiloa number, juhiluba, juhiluba number | 
| 芬蘭 | ajokortin numero, ajokortti, förare lic., körkort, körkort nummer, kuljettaja lic., permis de conduire | 
| 法國 | permis de conduire | 
| 德國 | fuehrerschein, fuehrerschein- nr, fuehrerscheinnummer, fuhrerschein, führerschein, fuhrerschein- nr, führerschein- nr, fuhrerscheinnummer, führerscheinnummer | 
| 希臘 | δεια οδήγησης, adeia odigisis | 
| 匈牙利 | illesztőprogramok lic, jogosítvány, jogsi, licencszám, vezető engedély, vezetői engedély | 
| 愛爾蘭 | ceadúnas tiomána | 
| 義大利 | patente di guida, patente di guida numero, patente guida, patente guida numero | 
| 拉脫維亞 | autovadītāja apliecība, licences numurs, vadītāja apliecība, vadītāja apliecības numurs, vadītāja atļauja, vadītāja licences numurs, vadītāji lic. | 
| 立陶宛 | vairuotojo pažymėjimas | 
| 盧森堡 | fahrerlaubnis, führerschäin | 
| 馬爾他 | liċenzja tas-sewqan | 
| 荷蘭 | permis de conduire, rijbewijs, rijbewijsnummer | 
| 波蘭 | numer licencyjny, prawo jazdy, zezwolenie na prowadzenie | 
| 葡萄牙 | carta de condução, carteira de habilitação, carteira de motorist, carteira habilitação, carteira motorist, licença condução, licença de condução, número de licença, número licença, permissão condução, permissão de condução | 
| 羅馬尼亞 | numărul permisului de conducere, permis de conducere | 
| 斯洛伐克 | číslo licencie, číslo vodičského preukazu, ovládače lic., povolenia vodičov, povolenie jazdu, povolenie na jazdu, povolenie vodiča, vodičský preukaz | 
| 斯洛維尼亞 | vozniško dovoljenje | 
| 西班牙 | carnet conducer, el carnet de conducer, licencia conducer, licencia de manejo, número carnet conducer, número de carnet de conducer, número de permiso conducer, número de permiso de conducer, número licencia conducer, número permiso conducer, permiso conducción, permiso conducer, permiso de conducción | 
| 瑞典 |  ajokortin numero, dlno\$1 ajokortti, drivere lic., förare lic., körkort, körkort nummer, körkortsnummer, kuljettajat lic.  | 
| 英國 | dl\$1, dl:, dlno\$1, driver licence, driver licences, driver license, driver licenses, driver permit, drivers lic., drivers licence, driver's licence, drivers licences, driver's licences, drivers license, driver's license, drivers licenses, driver's licenses, drivers permit, driver's permit, drivers permit number, driving licence, driving license, driving permit | 
| 美國 | dl\$1, dl:, dlno\$1, driver licence, driver licences, driver license, driver licenses, driver permit, drivers lic., drivers licence, driver's licence, drivers licences, driver's licences, drivers license, driver's license, drivers licenses, driver's licenses, drivers permit, driver's permit, drivers permit number, driving licence, driving license, driving permit | 

## 國民身分證號碼的關鍵字
<a name="CWL-managed-data-identifiers-pii-natlid-keywords"></a>

若要偵測各種類型的國民身分證號碼，CloudWatch Logs 要求關鍵字與號碼相鄰。這包括 Documento Nacional de Identidad (DNI) 識別符 (西班牙)、法國國家統計和經濟研究所 (INSEE) 代碼、德國國民身分證號碼和 Registro Geral (RG) 號碼 (巴西)。

下表列出 CloudWatch Logs 可辨識的特定國家和地區的關鍵字。


| 國家/地區或區域 | 關鍵字 | 
| --- | --- | 
| 巴西 | registro geral, rg | 
| 法國 | assurance sociale, carte nationale d’identité, cni, code sécurité sociale, French social security number, fssn\$1, insee, insurance number, national id number, nationalid\$1, numéro d'assurance, sécurité sociale, sécurité sociale non., sécurité sociale numéro, social, social security, social security number, socialsecuritynumber, ss\$1, ssn, ssn\$1 | 
| 德國 | ausweisnummer, id number, identification number, identity number, insurance number, personal id, personalausweis | 
| 義大利 | codice fiscal, dati anagrafici, ehic, health card, health insurance card, p. iva, partita i.v.a., personal data, tax code, tessera sanitaria | 
| 西班牙 | dni, dni\$1, dninúmero\$1, documento nacional de identidad, identidad único, identidadúnico\$1, insurance number, national identification number, national identity, nationalid\$1, nationalidno\$1, número nacional identidad, personal identification number, personal identity no, unique identity number, uniqueid\$1 | 

## 護照號碼的關鍵字
<a name="CWL-managed-data-identifiers-pii-passport-keywords"></a>

若要偵測各種類型的護照號碼，CloudWatch Logs 要求關鍵字與號碼相鄰。下表列出 CloudWatch Logs 可辨識的特定國家和地區的關鍵字。


| 國家/地區或區域 | 關鍵字 | 
| --- | --- | 
| 加拿大 | passeport, passeport\$1, passport, passport\$1, passportno, passportno\$1 | 
| 法國 | numéro de passeport, passeport, passeport\$1, passeport \$1, passeportn °, passeport n °, passeportNon, passeport non | 
| 德國 | ausstellungsdatum, ausstellungsort, geburtsdatum, passport, passports, reisepass, reisepass–nr, reisepassnummer | 
| 義大利 | italian passport number, numéro passeport, numéro passeport italien, passaporto, passaporto italiana, passaporto numero, passport number, repubblica italiana passaporto | 
| 西班牙 | españa pasaporte, libreta pasaporte, número pasaporte, pasaporte, passport, passport book, passport no, passport number, spain passport | 
| 英國 | passeport \$1, passeport n °, passeportNon, passeport non, passeportn °, passport \$1, passport no, passport number, passport\$1, passportid | 
| 美國 | passport, travel document | 

## 納稅識別號碼及參考號碼的關鍵字
<a name="CWL-managed-data-identifiers-financial-tin-keywords"></a>

為了偵測各種類型的納稅人識別和參考號碼，CloudWatch Logs 要求關鍵字與這些號碼相鄰。下表列出 CloudWatch Logs 可辨識的特定國家和地區的關鍵字。


| 國家/地區或區域 | 關鍵字 | 
| --- | --- | 
| 巴西 | cadastro de pessoa física, cadastro de pessoa fisica, cadastro de pessoas físicas, cadastro de pessoas fisicas, cadastro nacional da pessoa jurídica, cadastro nacional da pessoa juridica, cnpj, cpf | 
| 法國 | numéro d'identification fiscale, tax id, tax identification number, tax number, tin, tin\$1 | 
| 德國 | identifikationsnummer, steuer id, steueridentifikationsnummer, steuernummer, tax id, tax identification number, tax number | 
| 西班牙 | cif, cif número, cifnúmero\$1, nie, nif, número de contribuyente, número de identidad de extranjero, número de identificación fiscal, número de impuesto corporativo, personal tax number, tax id, tax identification number, tax number, tin, tin\$1 | 
| 英國 | paye, tax id, tax id no., tax id number, tax identification, tax identification\$1, tax no., tax number, tax reference, tax\$1, taxid\$1, temporary reference number, tin, trn, unique tax reference, unique taxpayer reference, utr | 
| 美國 | 個人納稅人識別號碼，itin，i.t.i.n。 | 

## 個人身分識別資訊 (PII) 的資料識別符 ARN
<a name="CWL-data-protection-pii-arns"></a>

下表列出您可新增至資料保護政策的個人身分識別資訊 (PII) 資料識別符的 Amazon Resource Name (ARN)。


| PII 資料識別符 ARN | 
| --- | 
| arn:aws:dataprotection::aws:data-identifier/Address | 
| arn:aws:dataprotection::aws:data-identifier/CepCode-BR | 
| arn:aws:dataprotection::aws:data-identifier/Cnpj-BR | 
| arn:aws:dataprotection::aws:data-identifier/CpfCode-BR | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-AT | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-AU | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-BE | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-BG | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-CA | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-CY | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-CZ | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-DE | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-DK | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-EE | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-ES | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-FI | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-FR | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-GB | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-GR | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-HR | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-HU | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-IE | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-IT | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-LT | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-LU | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-LV | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-MT | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-NL | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-PL | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-PT | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-RO | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-SE | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-SI | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-SK | 
| arn:aws:dataprotection::aws:data-identifier/DriversLicense-US | 
| arn:aws:dataprotection::aws:data-identifier/ElectoralRollNumber-GB | 
| arn:aws:dataprotection::aws:data-identifier/EmailAddress | 
| arn:aws:dataprotection::aws:data-identifier/IndividualTaxIdentificationNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/InseeCode-FR | 
| arn:aws:dataprotection::aws:data-identifier/LatLong | 
| arn:aws:dataprotection::aws:data-identifier/Name | 
| arn:aws:dataprotection::aws:data-identifier/NationalIdentificationNumber-DE | 
| arn:aws:dataprotection::aws:data-identifier/NationalIdentificationNumber-ES | 
| arn:aws:dataprotection::aws:data-identifier/NationalIdentificationNumber-IT | 
| arn:aws:dataprotection::aws:data-identifier/NieNumber-ES | 
| arn:aws:dataprotection::aws:data-identifier/NifNumber-ES | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-CA | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-DE | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-ES | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-FR | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-GB | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-IT | 
| arn:aws:dataprotection::aws:data-identifier/PassportNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/PermanentResidenceNumber-CA | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-BR | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-DE | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-ES | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-FR | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-GB | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-IT | 
| arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US | 
| arn:aws:dataprotection::aws:data-identifier/PostalCode-CA | 
| arn:aws:dataprotection::aws:data-identifier/RgNumber-BR | 
| arn:aws:dataprotection::aws:data-identifier/SocialInsuranceNumber-CA | 
| arn:aws:dataprotection::aws:data-identifier/Ssn-ES | 
| arn:aws:dataprotection::aws:data-identifier/Ssn-US | 
| arn:aws:dataprotection::aws:data-identifier/TaxId-DE | 
| arn:aws:dataprotection::aws:data-identifier/TaxId-ES | 
| arn:aws:dataprotection::aws:data-identifier/TaxId-FR | 
| arn:aws:dataprotection::aws:data-identifier/TaxId-GB | 
| arn:aws:dataprotection::aws:data-identifier/VehicleIdentificationNumber | 
| arn:aws:dataprotection::aws:data-identifier/ZipCode-US | 

# 自訂資料識別符
<a name="CWL-custom-data-identifiers"></a>

**Topics**
+ [什麼是 SNS 自訂資料識別符？](#what-are-custom-data-identifiers)
+ [自訂資料識別符的限制](#custom-data-identifiers-constraints)
+ [在主控台中使用自訂資料識別符](#using-custom-data-identifiers-console)
+ [在您的資料保護政策中使用自訂資料識別符](#using-custom-data-identifiers)

## 什麼是 SNS 自訂資料識別符？
<a name="what-are-custom-data-identifiers"></a>

自訂資料識別符 (CDI) 可讓您定義自訂的規則運算式，以用於資料保護政策。使用自訂資料識別符就可以鎖定[受管資料識別符](CWL-managed-data-identifiers.md)無法提供的企業特定個人身分識別資訊 (PII) 使用案例。例如，您可以使用自訂資料識別符來尋找公司專屬員工 ID。自訂資料識別符可與受管資料識別符搭配使用。

## 自訂資料識別符的限制
<a name="custom-data-identifiers-constraints"></a>

CloudWatch Logs 自訂資料識別符有下列限制：
+ 每個資料保護政策最多可支援 10 個自訂資料識別符。
+ 自訂資料識別符名稱的長度上限為 128 個字元。支援的字元如下：
  + 英數字：(a-zA-Z0-9)
  + 符號：( '\$1' \$1 '-' )
+ RegEx 的長度上限為 200 個字元。支援的字元如下：
  + 英數字：(a-zA-Z0-9)
  + 符號：( '\$1' \$1 '\$1' \$1 '=' \$1 '@' \$1'/' \$1 ';' \$1 ',' \$1 '-' \$1 ' ' )
  + RegEx 保留字元：( '^' \$1 '\$1' \$1 '?' \$1 '[' \$1 ']' \$1 '\$1' \$1 '\$1' \$1 '\$1' \$1 '\$1\$1' \$1 '\$1' \$1 '\$1' \$1 '.' ) 
+ 自訂資料識別符的名稱不可與受管資料識別符的名稱相同。
+ 您可以在帳戶層級資料保護政策或日誌群組層級資料保護政策中指定自訂資料識別符。與受管資料識別符類似，帳戶層級政策中定義的自訂資料識別符可與日誌群組層級政策中定義的自訂資料識別符搭配使用。

## 在主控台中使用自訂資料識別符
<a name="using-custom-data-identifiers-console"></a>

當您使用 CloudWatch 主控台建立或編輯資料保護政策時，若要指定自訂資料識別符，您只需輸入資料識別符的名稱和規則表達式。例如，您可以**Employee\$1ID**輸入 **EmployeeID-\$1d\$19\$1**做為名稱和規則表達式。此規則表達式會在 之後偵測和遮罩具有九個數字的日誌事件`EmployeeID-`。例如 `EmployeeID-123456789`

## 在您的資料保護政策中使用自訂資料識別符
<a name="using-custom-data-identifiers"></a>

如果您使用 AWS CLI 或 AWS API 來指定自訂資料識別符，則需要在用來定義資料保護政策的 JSON 政策中包含資料識別符名稱和規則表達式。下列資料保護政策會偵測和遮罩帶有公司特定員工 IDs日誌事件。

1. 在您的資料保護政策內建立 `Configuration` 區塊。

1. 輸入自訂資料識別符的 `Name`。例如 **EmployeeId**。

1. 輸入自訂資料識別符的 `Regex`。例如 **EmployeeID-\$1d\$19\$1**。此規則表達式將符合包含 之後有九位數`EmployeeID-`的日誌事件`EmployeeID-`。例如 `EmployeeID-123456789` 

1. 請參閱政策聲明中的下列自訂資料識別符。

   ```
   {
       "Name": "example_data_protection_policy",
       "Description": "Example data protection policy with custom data identifiers",
       "Version": "2021-06-01",
       "Configuration": {
         "CustomDataIdentifier": [
           {"Name": "EmployeeId", "Regex": "EmployeeId-\\d{9}"}   
         ]
       },
       "Statement": [
           {
               "Sid": "audit-policy",
               "DataIdentifier": [
                   "EmployeeId"
               ],
               "Operation": {
                   "Audit": {
                       "FindingsDestination": {
                           "S3": {
                               "Bucket": "EXISTING_BUCKET"
                           }
                       }
                   }
               }
           },
           {
               "Sid": "redact-policy",
               "DataIdentifier": [
               "EmployeeId"
               ],
               "Operation": {
                   "Deidentify": {
                       "MaskConfig": {
                       }
                   }
               }
           }
       ]
   }
   ```

1. (選用) 視需要繼續將其他**自訂資料識別符**新增至 `Configuration` 區塊。資料保護政策目前最多可支援 10 個自訂資料識別符。