
VPC Flow Logs and Packet Mirroring both observe traffic at VM network interfaces, but they capture very different things. VPC Flow Logs record sampled, summarized metadata about network flows and send it to Cloud Logging. Packet Mirroring clones full packets, headers and payloads, and delivers the copies to collector instances for analysis. On the Professional Cloud Network Engineer exam, the choice between them usually follows from one question: does the requirement need connection metadata, or does it need the packets themselves?
VPC Flow Logs record samples of network flows sent to and from VM network interfaces. You enable them per subnet, Google Cloud collects them without anything installed in the VM, and the records go to Cloud Logging. Each record includes:
connection field holding the 5-tuple of the flow: src_ip, src_port, dest_ip, dest_port and protocolsrc_location, which holds country and region but not the IP addressIn a Shared VPC, flow logs are enabled on the subnet from the host project.
Flow logs answer questions about who is talking to whom. Because each record carries the 5-tuple, the VM details and byte and packet counts, flow logs can show which sources are sending traffic to a VM and which VMs, protocols and ports carry the most traffic over a period of time. The records can also be routed from Cloud Logging to BigQuery with a Cloud Logging sink for analysis with SQL. You can adjust the sampling rate and aggregation interval to keep logging costs low, and there is nothing extra to deploy or maintain.
Packet Mirroring clones the full packets from selected VM interfaces and sends the copies to collector instances behind an internal passthrough Network Load Balancer. The collectors can run tools such as tcpdump or an IDS. Because they receive copies, the collectors analyze traffic out of band and never sit in the live traffic path. Packet Mirroring fits requirements that need the packets themselves, such as packet-level troubleshooting or giving an intrusion detection tool payloads to inspect.
Packet Mirroring costs more than flow logs, because you run and size collectors and a load balancer and pay for the mirrored traffic.
Two other log types sit near this topic but serve different purposes. Firewall Rules Logging records which firewall rule matched a connection, not packet contents or traffic volume. Cloud Audit Logs record API activity and configuration changes on Google Cloud resources rather than data plane network traffic.
We would start with VPC Flow Logs whenever the requirement is about addresses, ports, protocols or traffic volume, especially when cost and operational overhead matter, because flow logs are managed and need no collectors. Packet Mirroring is the right choice when the requirement needs the actual packet contents, and when it does, the collector type, region and zone rules above determine the layout. For the Professional Cloud Network Engineer exam, keeping that metadata versus payload split in mind settles most questions about which one fits.
Our Professional Cloud Network Engineer practice exams cover VPC Flow Logs and Packet Mirroring alongside Firewall Rules Logging and Network Intelligence Center, with detailed explanations that drill these distinctions.