

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

# 使用 APIs 或 CLI 建立和管理 AWS 傳輸閘道流量日誌
<a name="flow-logs-api-cli"></a>

您可以使用命令列執行此頁面所述的任務。

使用 [create-flow-logs](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-flow-logs.html) 命令時，適用下列限制：
+ `--resource-ids` 的 `TransitGateway` 或 `TransitGatewayAttachment` 資源類型上限為 25 個。
+ `--traffic-type` 不是預設的必要欄位。如果您為傳輸閘道資源類型提供此值，則會傳回錯誤。此限制僅適用於傳輸閘道資源類型。
+ `--max-aggregation-interval` 的預設值為 `60`，並且是傳輸閘道資源類型唯一接受的值。如果您嘗試傳遞任何其他值，則會傳回錯誤。此限制僅適用於傳輸閘道資源類型。
+ `--resource-type` 支援兩種新的資源類型：`TransitGateway` 和 `TransitGatewayAttachment`。
+ 如果您未設定要包含哪些欄位，`--log-format` 則會包含傳輸閘道資源類型的所有日誌欄位。這僅適用於傳輸閘道資源類型。

**建立流量日誌**
+ [create-flow-logs](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-flow-logs.html) (AWS CLI)
+ [新的 EC2 流量日誌](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2FlowLog.html) (AWS Tools for Windows PowerShell)

**描述您的流量日誌**
+ [describe-flow-logs](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-flow-logs.html) (AWS CLI)
+ [獲得 EC2 流量日誌](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2FlowLog.html) (AWS Tools for Windows PowerShell)

**檢視您的流量日誌記錄 (日誌事件)**
+ [get-log-events](https://docs.aws.amazon.com/cli/latest/reference/logs/get-log-events.html) (AWS CLI)
+ [獲得 CWL 日誌事件](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-CWLLogEvent.html) (AWS Tools for Windows PowerShell)

**刪除流量日誌**
+ [delete-flow-logs](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-flow-logs.html) (AWS CLI)
+ [移除 EC2 流量日誌](https://docs.aws.amazon.com/powershell/latest/reference/items/Remove-EC2FlowLog.html) (AWS Tools for Windows PowerShell)