Creates a flow log.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateFlowLog

The operation that you want to perform. Set the value to CreateFlowLog.

RegionId String Yes cn-qingdao

The ID of the region where you want to create the flow log. You can call the DescribeRegions operation to query the most recent region list.

FlowLogName String No myFlowlog

The name of the flow log.

The name must be 2 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.

Description String No This is my Flowlog.

The description of the flow log.

The description must be 2 to 256 characters in length. It must start with a letter but cannot start with http:// or https://.

ResourceType String Yes NetworkInterface

The type of the resource whose traffic you want to capture. Valid values:

  • NetworkInterface: an elastic network interface (ENI)
  • VSwitch: all ENIs in a vSwitch
  • VPC: all ENIs in a virtual private cloud (VPC)
ResourceId String Yes eni-askldfas****

The ID of the resource whose traffic you want to capture.

TrafficType String Yes All

The type of traffic that you want to capture. Valid values:

  • All: all traffic
  • Allow: allowed traffic
  • Drop: denied traffic
ProjectName String Yes FlowLogProject

The name of the project that stores the captured traffic data.

  • The name can contain only lowercase letters, digits, and hyphens (-).
  • The name must start and end with a lowercase letter or a digit.
  • The name must be 3 to 63 characters in length.
LogStoreName String Yes FlowLogStore

The name of the Logstore that stores the captured traffic data.

  • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
  • The name must start and end with a lowercase letter or a digit.
  • The name must be 3 to 63 characters in length.

Response parameters

Parameter Type Example Description
RequestId String 54B48E3D-DF70-471B-AA93-08E683A1B457

The ID of the request.

Success String true

Indicates whether the call was successful. Valid values:

  • true: yes
  • false: no
FlowLogId String fl-m5e8vhz2t21sel1nq****

The ID of the flow log.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateFlowLog
&ResourceOwnerId=253460731706911258
&RegionId=cn-qingdao
&FlowLogName=myFlowlog
&Description=This is my Flowlog.
&ResourceType=NetworkInterface
&ResourceId=eni-askldfas****
&TrafficType=All
&ProjectName=FlowLogProject
&LogStoreName=FlowLogStore
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateFlowLogResponse>
    <RequestId>54B48E3D-DF70-471B-AA93-08E683A1B457</RequestId>
    <Success>true</Success>
    <FlowLogId>fl-m5e8vhz2t21sel1nq****</FlowLogId>
</CreateFlowLogResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 OperationUnsupported.AdvancedFeature Advanced features of the vpc is unsupported. The error message returned because the advanced feature is not supported.
400 INVALID_PARAMETER The parameter invalid. The error message returned because the parameter is set to an invalid value.
400 MissingParameter Missing mandatory parameter The error message returned because required parameters are not set. Check whether you have set all required parameters before you call this operation.

For a list of error codes, visit the API Error Center.