Creates a flow log.
Operation description
CreateFlowLog is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the DescribeFlowLogs operation to query the status of the flow log.
- If the flow log is in the Activating state, the flow log is being created.
- If the flow log is in the Active state, the flow log is created and started.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vpc:CreateFlowLog | create | *VSwitch acs:vpc:{#regionid}:{#accountId}:vswitch/{#VSwitchId} *FlowLog acs:vpc:{#regionId}:{#accountId}:flowlog/* *VPC acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | 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. | cn-qingdao |
FlowLogName | string | No | The name of the flow log. The name must be 1 to 128 characters in length and cannot start with | myFlowlog |
Description | string | No | The description of the flow log. The description must be 1 to 256 characters in length and cannot start with | This is my Flowlog. |
ResourceType | string | Yes | The type of the resource whose traffic you want to capture. Valid values:
| NetworkInterface |
ResourceId | string | Yes | The ID of the resource whose traffic you want to capture. | eni-askldfas**** |
TrafficType | string | Yes | The type of traffic that you want to capture. Valid values:
| All |
ProjectName | string | Yes | The name of the project that stores the captured traffic data.
| FlowLogProject |
LogStoreName | string | Yes | The name of the Logstore that stores the captured traffic data.
| FlowLogStore |
AggregationInterval | integer | No | The sampling interval of the flow log. Unit: seconds. Valid values: 1, 5, and 10 (default). | 10 |
TrafficPath | array | No | The scope of the traffic that you want to capture. Valid values:
| |
string | No | The scope of the traffic that you want to capture. Valid values:
Note
By default, this parameter is unavailable. To use this parameter, submit a ticket.
| all | |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmxazdjdhd**** |
Tag | array<object> | No | The tag of the resource. | |
object | No | |||
Key | string | No | The key of tag N to add to the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. The tag key can be at most 128 characters in length. It cannot start with | FinanceDept |
Value | string | No | The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain | FinanceJoshua |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B457",
"Success": "true",
"FlowLogId": "fl-m5e8vhz2t21sel1nq****",
"ResourceGroupId": "rg-acfmxazdjdhd****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | IncorrectBusinessStatus.FlowLog | The business status of flowLog is incorrect. | The error message returned because you cannot create flow logs in the current business state. |
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. | The error message returned because you do not have the permissions to use the flow log feature. Make sure that the flow log feature is already enabled. |
400 | OperationUnsupported.AdvancedFeature | Advanced features of the vpc is unsupported. | This advanced feature is not supported. |
400 | InvalidInstanceId | vswitch does not exist. | The error message returned because the vSwitch does not exist. |
400 | InvalidInstanceId | NetworkInterface does not exist. | The error message returned because the ENI does not exist. |
400 | InvalidInstanceId | VPC does not exists. | The error message returned because the VPC does not exist. |
400 | ProjectOrLogstoreNotExist | The specified project or logstore does not exist. | The error message returned because the specified project or Logstore does not exist. |
400 | SourceProjectNotExist | The Source Project or logstore does not exist. | The error message returned because the source project or Logstore does not exist. |
400 | Unauthorized | This api does not support sub user or role. | The error message returned because you cannot call this operation as a RAM user. |
400 | OperationUnsupported.action | This action is not support. | The error message returned because the operation is not supported. |
400 | ParameterInvalid | Invalid parameter. | The error message returned because a parameter is invalid. |
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. | The number of flow logs reaches the upper limit. |
400 | InvalidResourceId.NotFound | This resourceId already has flowlog instance existed. | A flow log is already enabled for the resource. |
400 | INVALID_PARAMETER | The parameter invalid. | A parameter is set to an invalid value. |
400 | MissingParameter | Missing mandatory parameter | Required parameters are not specified. Check whether you have specified all required parameters before you call this operation. |
400 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | The RegionId parameter is set to an invalid value. Specify a valid value and try again. |
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. | The current user does not have the permissions to specify trafficPath. |
400 | IllegalParam.TrafficPath | The param of trafficPath is illegal. | TrafficPath.N is set to an invalid value. |
400 | DuplicatedParam.TrafficPath | The param of trafficPath is duplicated. | The value of TrafficPath.N is duplicate. |
400 | IllegalParam.ResourceGroupId | Invalid ResourceGroupld value. | The specified resource group is invalid or does not exist. |
400 | OperationDenied.OperateShareResource | The operation is not allowed because of OperateShareResource. | Operating on shared resources causes the operation to fail |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-11-20 | The Error code has changed | View Change Details |
2024-10-29 | The Error code has changed | View Change Details |
2024-09-25 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2024-04-28 | The Error code has changed | View Change Details |
2023-07-05 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-05-18 | The Error code has changed | View Change Details |
2021-11-17 | The Error code has changed. The request parameters of the API has changed | View Change Details |