

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

# CloudWatch 日誌項目範例
<a name="cw-example-logs"></a>

本主題提供範例日誌項目。

**Topics**
+ [轉移工作階段日誌項目範例](#session-log-examples)
+ [SFTP 連接器的範例日誌項目](#example-sftp-connector-logs)
+ [VPC Lattice 連接器的範例日誌項目](#example-vpc-lattice-connector-logs)
+ [金鑰交換演算法失敗的範例日誌項目](#example-kex-logs)

## 轉移工作階段日誌項目範例
<a name="session-log-examples"></a>

在此範例中，SFTP 使用者連線至 Transfer Family 伺服器、上傳檔案，然後中斷與工作階段的連線。

下列日誌項目反映連線至 Transfer Family 伺服器的 SFTP 使用者。

```
{
   "role": "arn:aws:iam::500655546075:role/transfer-s3",
   "activity-type": "CONNECTED",
   "ciphers": "chacha20-poly1305@openssh.com,chacha20-poly1305@openssh.com",
   "client": "SSH-2.0-OpenSSH_7.4",
   "source-ip": "52.94.133.133",
   "resource-arn": "arn:aws:transfer:us-east-1:500655546075:server/s-3fe215d89f074ed2a",
   "home-dir": "/test/log-me",
   "ssh-public-key": "AAAAC3NzaC1lZDI1NTE5AAAAIA9OY0qV6XYVHaaOiWAcj2spDJVbgjrqDPY4pxd6GnHl",
   "ssh-public-key-fingerprint": "SHA256:BY3gNMHwTfjd4n2VuT4pTyLOk82zWZj4KEYEu7y4r/0",
   "ssh-public-key-type": "ssh-ed25519",
   "user": "log-me",
   "kex": "ecdh-sha2-nistp256",
   "session-id": "9ca9a0e1cec6ad9d"
}
```

下列日誌項目反映 SFTP 使用者將檔案上傳至其 Amazon S3 儲存貯體。

```
{
   "mode": "CREATE|TRUNCATE|WRITE",
   "path": "/test/log-me/config-file",
   "activity-type": "OPEN",
   "resource-arn": "arn:aws:transfer:us-east-1:500655546075:server/s-3fe215d89f074ed2a",
   "session-id": "9ca9a0e1cec6ad9d"
}
```

下列日誌項目反映 SFTP 使用者中斷與其 SFTP 工作階段的連線。首先，用戶端會關閉與儲存貯體的連線，然後用戶端會中斷 SFTP 工作階段的連線。

```
{
   "path": "/test/log-me/config-file",
   "activity-type": "CLOSE",
   "resource-arn": "arn:aws:transfer:us-east-1:500655546075:server/s-3fe215d89f074ed2a",
   "bytes-in": "121",
   "session-id": "9ca9a0e1cec6ad9d"
}

{
   "activity-type": "DISCONNECTED",
   "resource-arn": "arn:aws:transfer:us-east-1:500655546075:server/s-3fe215d89f074ed2a",
   "session-id": "9ca9a0e1cec6ad9d"
}
```

**注意**  
可用的活動類型如下：`AUTH_FAILURE`、`CONNECTED`、`DISCONNECTED`、`ERROR``EXIT_REASON`、`CLOSE`、`CREATE_SYMLINK`、`DELETE`、`MKDIR`、、`OPEN``PARTIAL_CLOSE`、`RENAME`、`RMDIR`、、、`SETSTAT`、、`TLS_RESUME_FAILURE`、。

## SFTP 連接器的範例日誌項目
<a name="example-sftp-connector-logs"></a>

本節包含成功和失敗傳輸的範例日誌。日誌會產生到名為 的日誌群組`/aws/transfer/connector-id`，其中 *connector-id* 是 SFTP 連接器的識別符。當您執行 `StartFileTransfer`或 `StartDirectoryListing`命令時，會產生 SFTP 連接器的日誌項目。

此日誌項目適用於成功完成的傳輸。

```
{
    "operation": "RETRIEVE",
    "timestamp": "2023-10-25T16:33:27.373720Z",
    "connector-id": "connector-id",
    "transfer-id": "transfer-id",
    "file-transfer-id": "transfer-id/file-transfer-id",
    "url": "sftp://192.0.2.0",
    "file-path": "/remotebucket/remotefilepath",
    "status-code": "COMPLETED",
    "start-time": "2023-10-25T16:33:26.945481Z",
    "end-time": "2023-10-25T16:33:27.159823Z",
    "account-id": "480351544584",
    "connector-arn": "arn:aws:transfer:us-east-1:account-id:connector/connector-id",
    "local-directory-path": "/connectors-localbucket",
    "bytes": 514,
    "egress-type": "SERVICE_MANAGED"
}
```

此日誌項目適用於逾時的傳輸，因此無法成功完成。

```
{
    "operation": "RETRIEVE",
    "timestamp": "2023-10-25T22:33:47.625703Z",
    "connector-id": "connector-id",
    "transfer-id": "transfer-id",
    "file-transfer-id": "transfer-id/file-transfer-id",
    "url": "sftp://192.0.2.0",
    "file-path": "/remotebucket/remotefilepath",
    "status-code": "FAILED",
    "failure-code": "TIMEOUT_ERROR",
    "failure-message": "Transfer request timeout.",
    "account-id": "480351544584",
    "connector-arn": "arn:aws:transfer:us-east-1:account-id:connector/connector-id",
    "local-directory-path": "/connectors-localbucket",
    "egress-type": "SERVICE_MANAGED"
}
```

此日誌項目適用於成功的 SEND 操作。

```
{
    "operation": "SEND",
    "timestamp": "2024-04-24T18:16:12.513207284Z",
    "connector-id": "connector-id",
    "transfer-id": "transfer-id",
    "file-transfer-id": "transfer-id/file-transfer-id",
    "url": "sftp://server-id.server.transfer.us-east-1.amazonaws.com",
    "file-path": "/amzn-s3-demo-bucket/my-test-folder/connector-metrics-us-east-1-2024-01-02.csv",
    "status-code": "COMPLETED",
    "start-time": "2024-04-24T18:16:12.295235884Z",
    "end-time": "2024-04-24T18:16:12.461840732Z",
    "account-id": "255443218509",
    "connector-arn": "arn:aws:transfer:us-east-1:account-id:connector/connector-id",
    "bytes": 275,
    "egress-type": "SERVICE_MANAGED"
}
```

先前日誌範例中某些索引鍵欄位的描述。
+ `timestamp` 代表日誌新增至 CloudWatch 的時間。 `start-time`和 `end-time`對應至連接器實際啟動和完成傳輸的時間。
+ `transfer-id` 是為每個`start-file-transfer`請求指派的唯一識別符。如果使用者在單一 `start-file-transfer` API 操作中傳遞多個檔案路徑，則所有檔案都會共用相同的 `transfer-id`。
+ `file-transfer-id` 是為每個傳輸的檔案產生的唯一值。請注意， 的初始部分`file-transfer-id`與 相同`transfer-id`。

## VPC Lattice 連接器的範例日誌項目
<a name="example-vpc-lattice-connector-logs"></a>

本節包含 VPC Lattice 連接器的範例日誌。對於 VPC Lattice 連接器，日誌包含提供連接器組態和網路設定相關資訊的其他欄位。

此日誌項目適用於成功完成的 VPC Lattice 連接器 SEND 操作。

```
{
  "operation": "SEND",
  "timestamp": "2025-09-05T14:20:19.577192454Z",
  "connector-id": "connector-id",
  "transfer-id": "transfer-id",
  "file-transfer-id": "transfer-id/file-transfer-id",
  "file-path": ""/amzn-s3-demo-bucket/my-test-folder/connector-vpc-lattice-us-east-1-2025-03-22.csv"",
  "status-code": "COMPLETED",
  "start-time": "2025-09-05T14:20:19.434072509Z",
  "end-time": "2025-09-05T14:20:19.481453346Z",
  "account-id": "account-id",
  "connector-arn": "arn:aws:transfer:us-east-1:account-id:connector/connector-id",
  "remote-directory-path": "/test-bucket/test-folder/",
  "bytes": 262,
  "egress-type": "VPC_LATTICE",
  "vpc-lattice-resource-configuration-arn": "arn:aws:vpc-lattice:us-east-1:account-id:resourceconfiguration/resource-configuration-arn-id,
  "vpc-lattice-port-number": 22
}
```

VPC Lattice 連接器日誌包含下列其他欄位：
+ `egress-type` - 連接器的輸出組態類型
+ `vpc-lattice-resource-configuration-arn` - 定義目標 SFTP 伺服器位置的 VPC Lattice 資源組態 ARN
+ `vpc-lattice-port-number` - 透過 VPC Lattice 連線至 SFTP 伺服器的連接埠號碼

## 金鑰交換演算法失敗的範例日誌項目
<a name="example-kex-logs"></a>

本節包含金鑰交換演算法 (KEX) 失敗的範例日誌。這些是結構化日誌之 **ERRORS** 日誌串流中的範例。

此日誌項目是發生主機金鑰類型錯誤的範例。

```
{
    "activity-type": "KEX_FAILURE",
    "source-ip": "999.999.999.999",
    "resource-arn": "arn:aws:transfer:us-east-1:999999999999:server/s-999999999999999999",
    "message": "no matching host key type found",
    "kex": "ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss"
}
```

此日誌項目是 KEX 不相符的範例。

```
{
    "activity-type": "KEX_FAILURE",
    "source-ip": "999.999.999.999",
    "resource-arn": "arn:aws:transfer:us-east-1:999999999999:server/s-999999999999999999",
    "message": "no matching key exchange method found",
    "kex": "diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256"
}
```