VPC Flow Logs vs Packet Mirroring in Google Cloud

GCP Study Hub
November 11, 2026

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?

What VPC Flow Logs record

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:

  • a connection field holding the 5-tuple of the flow: src_ip, src_port, dest_ip, dest_port and protocol
  • source and destination VM details
  • byte and packet counts
  • geographic details in fields such as src_location, which holds country and region but not the IP address

In a Shared VPC, flow logs are enabled on the subnet from the host project.

What flow logs are good for

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.

The limits of flow logs

  • Flow logs record summarized connection metadata, never packet payloads.
  • They are sampled. Even at the highest sample rate and shortest aggregation interval, flow logging applies its own internal sampling, so brief or infrequent traffic can be missed.
  • Packets dropped by a firewall never reach the VM, so flow logs are not reliable per-attempt records of blocked traffic. They also do not show which firewall rule or routing decision caused a failure.
  • They only record traffic after you enable them.

What Packet Mirroring does

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 design rules

  • Collector type: the collector must be an internal passthrough Network Load Balancer with the collector instances as its backends.
  • Region: the collector must be in the same region as the mirrored sources, so mirroring is set up region by region.
  • Other networks: the collector can live in a different VPC network, such as another team's project, as long as that network is connected to the mirrored network through VPC Network Peering.
  • Direction and filters: a policy can mirror only ingress traffic, and a protocol filter such as TCP keeps the copies focused.
  • Source selection: selecting VMs by network tag limits mirroring to the VMs that carry the tag. A subnet is regional and may be shared with other workloads, so a subnet source takes in every VM in it.
  • Zones and cost: mirrored copies sent to a collector in another zone count as inter-zone egress, so keeping collectors in the same zone as the sources they receive from avoids that cost.

Packet Mirroring costs more than flow logs, because you run and size collectors and a load balancer and pay for the mirrored traffic.

Other logs that are not traffic captures

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.

Choosing between them

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.

Get tips and updates from GCP Study Hub

arrow