CreateFlowLog

更新時間:
Copy as MD

建立流日誌。

介面說明

CreateFlowLog 介面屬於非同步介面,即系統會返回一個執行個體 ID,但該流日誌尚未建立完成,系統後台的建立任務仍在進行。您可以呼叫 DescribeFlowLogs 查詢流日誌的建立狀態:

  • 當流日誌處於 Activating 狀態時,表示流日誌正在建立中。

  • 當流日誌處於 Active 狀態時,表示流日誌建立並啟動完成。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

vpc:CreateFlowLog

create

VSwitch

acs:vpc:{#regionid}:{#accountId}:vswitch/{#VSwitchId}

*FlowLog

acs:vpc:{#regionId}:{#accountId}:flowlog/*

VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

流日誌所屬的地域 ID。您可以透過呼叫 DescribeRegions 介面取得地域 ID。

cn-qingdao

FlowLogName

string

流日誌名稱。

名稱長度為 1~128 個字元,不能以http://https://開頭。

myFlowlog

Description

string

流日誌描述。

描述長度為 1~256 個字元,不能以http://https://開頭。

This is my Flowlog.

ResourceType

string

要擷取流量的資源類型。取值:

  • NetworkInterface:彈性網卡。

  • VSwitch:交換機內的所有彈性網卡。

  • VPC:專有網路內的所有彈性網卡。

NetworkInterface

ResourceId

string

要擷取流量的資源 ID。

eni-askldfas****

TrafficType

string

採集的流量類型。取值:

  • All:全部流量。

  • Allow:存取控制允許的流量。

  • Drop:存取控制拒絕的流量。

All

ProjectName

string

管理擷取到的流量的 Project 名稱。

  • Project 名稱僅支援小寫字母、數字和短劃線(-)。

  • 名稱的開頭與結尾必須為小寫字母或數字。

  • 名稱長度為 3~63 個字元。

FlowLogProject

LogStoreName

string

儲存擷取到的流量的 LogStore 名稱。

  • LogStore 名稱僅支援小寫字母、數字、短劃線(-)和底線(_)。

  • 名稱的開頭與結尾必須為小寫字母或數字。

  • 名稱長度為 3~63 個字元。

FlowLogStore

AggregationInterval

integer

流日誌的取樣間隔。單位:分鐘。取值:1510(預設值)。

10

TrafficPath

array

採集的流量路徑。取值:

  • all:表示全量採集。

  • internetGateway:表示公網流量採集。

string

採集的流量路徑。取值:

  • all(預設值):表示全量採集。

說明

流量路徑功能預設不開放,如需使用,請提交工單申請。

all

ResourceGroupId

string

資源群組 ID。

rg-acfmxazdjdhd****

Tag

array<object>

資源的標籤。

object

標籤。

Key

string

資源的標籤鍵。最多支援輸入 20 個標籤鍵。如需傳入該值,請勿輸入空字串。

一個標籤鍵最多支援 128 個字元,不能以aliyunacs:開頭,不能包含http://或者https://

FinanceDept

Value

string

資源的標籤值。最多支援輸入 20 個標籤值。如果傳入該值,可以輸入空字串。

最多支援 128 個字元,不能以aliyunacs:開頭,不能包含http://或者https://

FinanceJoshua

IpVersion

string

流日誌採集流量的 IP 位址類型。

IPv4

返回參數

名稱

類型

描述

樣本值

object

請求 ID。

RequestId

string

請求 ID。

54B48E3D-DF70-471B-AA93-08E683A1B457

Success

string

是否呼叫成功。取值:

  • true:呼叫成功。

  • false:呼叫失敗。

true

FlowLogId

string

流日誌 ID。

fl-m5e8vhz2t21sel1nq****

ResourceGroupId

string

資源群組 ID。

rg-acfmxazdjdhd****

樣本

正常返回樣本

JSON格式

{
  "RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B457",
  "Success": "true",
  "FlowLogId": "fl-m5e8vhz2t21sel1nq****",
  "ResourceGroupId": "rg-acfmxazdjdhd****"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 IncorrectBusinessStatus.FlowLog The business status of flowLog is incorrect.
400 OptInRequired.FlowLog You are not authorized to use the requested service of flowLog. Ensure that you have subscribed to the service you are trying to use.
400 OperationUnsupported.AdvancedFeature Advanced features of the vpc is unsupported.
400 InvalidInstanceId vswitch does not exist.
400 ProjectOrLogstoreNotExist The specified project or logstore does not exist.
400 SourceProjectNotExist The Source Project or logstore does not exist.
400 Unauthorized This api does not support sub user or role.
400 OperationUnsupported.action This action is not support.
400 ParameterInvalid Invalid parameter.
400 RuleExist The rule has already existed.
400 InvalidHdMonitorStatus Current instance status is not valid for this action.
400 QuotaExceeded.FlowlogCount This user has reached the maximum instance number of flowlog.
400 InvalidResourceId.NotFound This resourceId already has flowlog instance existed.
400 INVALID_PARAMETER The parameter invalid.
400 MissingParameter Missing mandatory parameter
400 InvalidRegionId.NotFound The RegionId provided does not exist in our records.
400 InvalidResourceType.NotFound Resource type no the same.
400 OperationUnsupported.ResourceType This resource type is not supported.
400 IllegalParam.AggregationInterval The param of aggregationInterval is illegal.
400 UnsupportedFeature.UserDefinedTrafficPath The feature of UserDefinedTrafficPath is not supported.
400 IllegalParam.TrafficPath The param of trafficPath is illegal.
400 DuplicatedParam.TrafficPath The param of trafficPath is duplicated.
400 IllegalParam.ResourceGroupId Invalid ResourceGroupld value.
400 OperationDenied.OperateShareResource The operation is not allowed because of OperateShareResource.
400 UnsupportedFeature.IpVersion The ipversion type is not supported.
400 UnsupportedFeature.VpcAdvancedFeature The VPC does not support some advanced features.
400 OperationFailed.EniTypeNotSupport Operation failed because the ENI type is not supported.
400 IllegalParam.IpVersion The parameter of IpVersion is illegal.
400 OperationDenied.NisTrafficAnalyzerAggregationIntervalMismatch The sampling interval of the FlowLog is greater than the sampling interval of the NIS Traffic Analyzer.
400 OperationDenied.NisTrafficAnalyzerNotFound The specified NIS Traffic Analyzer does not exist.
400 OperationDenied.NisTrafficAnalyzerNotActive The specified NIS Traffic Analyzer is not enabled.
400 OperationFailed.InternalError The request processing has failed due to some unknown error.
400 MissingParam.TrafficAnalyzerIdOrLogProjectOrLogStore TrafficAnalyzerId and ProjectName and LogStoreName parameters are not passed in.
400 OperationDenied.AllTrafficPathOfManagedExist The resource you specified has created a flow log instance that collects the traffic of all scenarios. You cannot create a flow log instance that collects only some scenarios.
400 UnsupportedFeature.UserDefinedTrafficPathIpv6 Dual-stack flow log instances do not support custom trafficPath.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情