Virtual private clouds (VPCs) provide flow logs to record inbound and outbound traffic of an elastic network interface (ENI). You can use the feature to check access control list (ACL) rules, monitor network traffic, and troubleshoot network errors.
Overview
Flow logs
You can create flow logs for specific ENIs, VPCs, or vSwitches. Flow logs for a VPC or vSwitch capture all the traffic of ENIs, including ENIs added after flow logs have been enabled.
Flow log entries
Traffic information captured by flow logs is stored in Simple Log Service as flow log entries. Each log records the 5-tuples of the traffic flow within a specific window, which is referred to as a capture window. The default window is 10 minutes, but can be adjusted to 1 or 5 minutes. Within the capture window, the traffic information of a flow is captured and aggregated into a flow log entry.
You can configure the traffic to be captured for specific scenarios. The available options include All Traffic, Traffic Through IPv4 Gateway, Traffic Through NAT Gateway, Traffic Through VPN Gateway, Traffic Through Transit Router, Traffic That Accesses Cloud Service Through Gateway Endpoint, and Traffic That Accesses Express Connect Circuit Through VBR.
Fields of flow log entries
The following table outlines the fields for a flow log record:
Field | Description |
version | The version of the flow log. |
account-id | The Alibaba Cloud account ID. |
eni-id | The ENI ID. |
vm-id | The ID of the Elastic Compute Service (ECS) instance associated with the ENI. |
vswitch-id | The ID of the vSwitch to which the ENI belongs. |
vpc-id | The ID of the VPC to which the ENI belongs. |
type | The type of traffic. IPv4 traffic is supported. |
protocol | The Internet Assigned Numbers Authority (IANA) protocol of the traffic. For more information, see Internet protocol numbers. |
srcaddr | The source IP address. |
srcport | The source port. |
dstaddr | The destination IP address. |
dstport | The destination port. |
direction | The traffic direction. Valid values:
|
action | The actions you can perform on the traffic. Valid values:
|
packets | The number of data packets. |
bytes | The size of data packets. |
start | The start time of the capture window. |
end | The end time of the capture window. |
tcp-flags | TCP flags and their corresponding masks:
For more information about TCP flags, including the significance of SYN, FIN, ACK, and RST, see RFC 793. |
log-status | The status of flow logs:
|
traffic_path | The sampling paths of the traffic:
|
Flow log entry examples
The format of a flow log is as follows:
<account-id> <action> <bytes> <direction> <dstaddr> <dstport> <end> <eni-id> <log-status> <packets> <protocol> <srcaddr> <srcport> <start> <tcp-flags> <traffic_path> <type> <version> <vm-id> <vpc-id> <vswitch-id>
Normally recorded, traffic accepted
In this example, the Alibaba Cloud account ID is 1210123456****** and the VPC flow log version is 1. The ENI eni-bp166tg9uk1ryf******
allowed the following outbound traffic from 17:10:20 to 17:11:20 on July 12, 2024:
The source address 172.31.16.139 and port 1332 transmitted 10 packets to the destination address 172.31.16.21 and port 80 through TCP where 6 indicates TCP, with a total packet size of 2,048 bytes. The status of the flow log entry is OK and no exceptions occurred.
1210123456****** ACCEPT 2048 out 172.31.16.21 80 1720775480 eni-bp166tg9uk1ryf****** OK 10 6 172.31.16.139 1332 1720775420 22 - - 1 - vpc-bp1qf0c43jb3maz****** vsw-bp12632woke7abk******
Normally recorded, traffic denied
In this example, the Alibaba Cloud account ID is 1210123456****** and the VPC flow log version is 1. The ENI eni-bp1ftp5sm9oszt******
denied the following inbound traffic from 10:20:00 to 10:30:00 on July 15, 2024:
The source address 172.31.16.139 and port 1332 transmitted 20 packets to the destination address 172.31.16.21 and port 80 through TCP where 6 indicates TCP, with a total packet size of 4,208 bytes. The status of the flow log entry is OK and no exceptions occurred.
1210123456****** REJECT 4208 in 172.31.16.21 80 1721010600 eni-bp1ftp5sm9oszt****** OK 20 6 172.31.16.139 1332 1721010000 22 - - 1 - vpc-bp1qf0c43jb3maz****** vsw-bp12632woke7abk******
No data
In this example, the Alibaba Cloud account ID is 1210123456****** and the VPC flow log version is 1. No traffic data (status NODATA) was recorded on the ENI eni-bp1j7mmp34jlve******
from 10:52:20 to 10:55:20 on July 15, 2024.
1210123456****** - - - - - 1721012120 eni-bp1j7mmp34jlve****** NODATA - - - - 1721011940 - - - 1 - vpc-bp1qf0c43jb3maz****** vsw-bp12632woke7abk******
Data skipped
In this example, the Alibaba Cloud account is 1210123456****** and the VPC flow log version is 1. The data record of the ENI eni-bp1dfm4xnlpruv******
was skipped (status SKIPDATA) from 16:20:30 to 16:23:30 on July 12, 2024.
1210123456****** - - - - - 1720772610 eni-bp1dfm4xnlpruv****** SKIPDATA - - - - 1720772430 - - - 1 - vpc-bp1qf0c43jb3maz****** vsw-bp12632woke7abk******
Billing
For more information about flow log billing, see Billing.
Limits
Feature limits
If you use the flow log feature for the first time, click Activate Now on the Flow Log page.
When you click Activate Now, flow log instances that you have created will reappear on the flow log page.
Supported regions
Area | Region |
Asia Pacific | China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), China (Hong Kong), China (Fuzhou - Local Region), Japan (Tokyo), South Korea (Seoul), Singapore, Australia (Sydney) Closing Down, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Philippines (Manila), and Thailand (Bangkok) |
Europe & Americas | Germany (Frankfurt), UK (London), US (Silicon Valley), and US (Virginia) |
Middle East | UAE (Dubai) and SAU (Riyadh - Partner Region) Important The SAU (Riyadh - Partner Region) region is operated by a partner. |
Limits
Name/ID | Description | Default value | Adjustable |
vpc_quota_flowlog_inst_nums_per_user | Maximum number of flow logs that can be created by each account | 10 | You can increase the quota by performing the following operations:
|
Manage flow logs
Log on to the VPC console.
In the left-side navigation pane, select . In the top menu bar, select the region where you want to create a flow log.
You can proceed with the following operations based on your requirements:
Create or delete flow logs
Analyze flow logs
Start or stop flow logs
References
You can also manage flow logs by using SDK, Terraform, or ROS. For more information, see the following documents:
CreateFlowLog: Create a new flow log.
DescribeFlowLogs: Query existing flow logs.
ModifyFlowLogAttribute: Modify the parameters of a flow log.
ActiveFlowLog: Activate a flow log.
DeactiveFlowLog: Deactivate a flow log.
DeleteFlowLog: Delete a flow log.