How do you know what is happening inside your virtual network without physically touching any cables? VPC Flow Logs and Packet Mirroring are the two tools that give you that visibility — one gives you a summary of who talked to whom and when, the other gives you a complete recording of the conversation itself. For the PCNE exam, you need to understand when to use each tool, how they work, and what exam traps to avoid.
Jump to a section
A simple way to picture VPC Flow Logs and Packet Mirroring
When your friend sends a package through an airport's cargo system, the entire process creates a record. First, the package enters the system, and this triggers the airport's security cameras and logging systems to start working. The airport keeps a detailed log of every package movement: when it arrived, which conveyor belt it went through, when it left, and whether it was delivered successfully. This log is called a flow log — it tells you the metadata about the package's journey, not the contents of the package itself.
Now imagine that a security incident occurs, and the airport needs to understand exactly what happened to a specific package. The normal logs only show timestamps and belt numbers, not the actual radio frequency tag data inside the package. To see the real data, the airport deploys a mirror — a special camera that copies every single movement of that package in real time, sending the exact copy to a security analyst's screen for deep inspection. This is packet mirroring: it captures the complete data of the traffic, not just the metadata.
The key difference is simple: flow logs are like the security log book — when did it arrive, where did it go, was there a problem. Packet mirroring is like having a live video feed of the package's entire journey, including every detail inside. The airport uses flow logs for routine monitoring and cost tracking, but packet mirroring for serious investigations when they need to see exactly what was in the data.
Let's start with the network itself. A VPC (Virtual Private Cloud) is your private, isolated section of the cloud where you run your virtual machines, databases, and other services. These resources communicate with each other and with the internet using network traffic, which is divided into small chunks called packets. Each packet has a header with metadata (source and destination IP addresses, ports, protocol) and a payload containing the actual data being sent.
VPC Flow Logs are a feature from cloud providers (like Google Cloud) that captures metadata about every packet that flows through your VPC's network interfaces. Think of it as a log file that records each conversation: when it started, who was talking, what protocol they used, how much data was transferred, and whether the packet was allowed or blocked by firewall rules called VPC firewall rules. Flow logs do not capture the actual content of the communication — they only capture the metadata. This is critical because it means they are privacy-preserving and relatively cheap to store.
Here is how VPC Flow Logs work:
- Every network interface (called a virtual NIC or network interface card) in your VPC can generate flow log entries. - The log entries are pushed to a logging service like Cloud Logging, where you can analyse them or export them to a storage bucket for long-term retention. - Each log entry includes fields like: source IP, destination IP, source port, destination port, protocol (TCP/UDP/ICMP), bytes transferred, packets transferred, and the action taken (ACCEPT if the packet was allowed, DROP if it was denied by a firewall rule). - You can aggregate these logs by subnet, network, or specific instances. - Flow logs are typically sampled (for example, one log entry per 10 packets) to reduce cost and volume. You can adjust the sampling rate. - Flow logs are extremely useful for network troubleshooting (e.g., 'why can't my web server connect to the database?'), security auditing (e.g., 'who tried to connect to our internal server?'), and cost allocation (e.g., 'which VPC is using the most bandwidth?'). Now, Packet Mirroring is a completely different beast. Packet Mirroring creates a copy of every single packet that flows through a specific network interface and sends that copy to a collector (usually a virtual machine or a network appliance) for deep inspection. Unlike flow logs, packet mirroring captures the full packet — both the header and the payload. This means you can see the actual content of the data, such as the text of a web request or the bytes of a file transfer. How Packet Mirroring works:
- You create a mirroring policy that specifies which network interface (the 'mirror source') to copy traffic from. - You also specify a 'mirror destination' — a network endpoint that will receive and process the mirrored traffic. - The cloud provider's network infrastructure automatically copies each packet at the hypervisor level (the software that runs the virtual machine) and forwards the copy to the destination. - The original packet continues on its path undisturbed — the mirroring is passive and does not affect performance. - The mirrored traffic is typically sent to a network security appliance (like an intrusion detection system or IDS), a packet capture tool (like Wireshark), or a load balancer for analysis. - Packet Mirroring is used for deep security analysis, forensic investigations, protocol debugging, and when you need to see the actual content to identify malware or data exfiltration attempts. The key differences between the two tools:
- Data captured: Flow logs capture metadata only; Packet Mirroring captures the full packet including payload. - Storage cost: Flow logs are cheap and can store months of data; Packet Mirroring generates massive volumes of data (every packet) and is expensive to store long-term. - Use case: Flow logs for routine monitoring, alerting, and troubleshooting; Packet Mirroring for in-depth security analysis during incidents or compliance audits. - Performance impact: Both are passive, but Packet Mirroring uses more network bandwidth on the collector side. - Sampling: Flow logs are typically sampled; Packet Mirroring is not — it is a full copy of every packet. On the PCNE exam, you will encounter scenarios where you must choose the right tool. A common question: 'You need to see the payload of a suspicious connection to determine if it contains malware. Which tool do you use?' Answer: Packet Mirroring, because flow logs do not capture payloads. Another typical trap: 'You need to log all dropped packets for compliance. Which tool?' Answer: VPC Flow Logs (specifically with the action field set to DROP) because they are cheaper and store metadata for months, whereas packet mirroring is too expensive for continuous compliance logging.
Identify the monitoring need
Decide whether you need just metadata (who, what, when) or full packet content (the actual data). This step determines whether you use VPC Flow Logs or Packet Mirroring.
Enable VPC Flow Logs on the target resource
Navigate to the VPC subnet or the specific network interface in Google Cloud Console, and enable flow logs. Choose a sampling rate (e.g., 1 in 10 packets) and specify a log sink destination (like Cloud Logging). This captures metadata from that point forward.
Configure the flow log export
Set up a log sink to export flow logs to a storage bucket (for long-term archiving) or to BigQuery (for analysis). This allows you to run queries and create dashboards for monitoring traffic patterns.
Create a Packet Mirroring policy
In the Google Cloud Console, go to the Packet Mirroring section. Define the mirror source (the network interface of the instance you want to monitor) and the mirror destination (a virtual machine or load balancer that will receive the mirrored traffic). Set up the collector to process the packets.
Analyse the mirrored traffic
On the collector instance, use tools like Wireshark to inspect the captured packets. Identify any anomalous payloads, exfiltrated data, or protocol violations. Document findings for security reports or compliance audits.
Deactivate and clean up
After the investigation, disable Packet Mirroring to avoid ongoing costs. Keep flow logs running for continuous visibility, but consider adjusting the sampling rate or retention period to manage costs.
Imagine you are working as a cloud network engineer for a mid-sized e-commerce company that runs its entire website on Google Cloud. Your VPC contains web servers, application servers, and a database server. One day, the security team reports unusual outbound traffic from a database server to an unknown IP address. They suspect a data breach. Your job is to investigate. Step one: Use VPC Flow Logs to get a timeline. You enable flow logs on the database server's network interface and export them to Cloud Logging. You filter by the database server's IP and look for outbound traffic to unknown IPs. The logs show that for the past three hours, the database server has been sending small packets to an IP in another country every 30 seconds. The flow logs tell you the source port, destination port, and protocol (TCP), and that the packets were accepted by the firewall. This gives you a pattern. Step two: Deploy Packet Mirroring for deep inspection. Because you need to see the actual content of those packets (to confirm if it is exfiltrated customer data), flow logs are useless — they only show metadata. You create a packet mirroring rule that copies all traffic from the database server's network interface and sends it to a virtual machine running an intrusion detection system (IDS). The IDS captures the packets and analyses them. Step three: The IDS reveals the payload contains encrypted data that matches the format of your customer database. You now have evidence of a breach. You can see the exact data being sent because packet mirroring captured the full payload. You then block the outbound traffic using a firewall rule and isolate the database server. Step four: For ongoing compliance, you enable VPC Flow Logs on all critical servers. You set up an automated alert in Cloud Logging that triggers if any server sends more than 1GB of outbound data in an hour (a potential exfiltration indicator). You also periodically enable Packet Mirroring for short durations (e.g., one hour per week) on the most sensitive servers to randomly audit traffic content. What you learn from this scenario: Flow logs are your everyday visibility tool — cheap, always on, good for spotting patterns and anomalies. Packet Mirroring is your forensic scalpel — expensive, used only when you need to examine the exact content. When the exam asks about incident response, you pick packet mirroring for payload analysis. When it asks about continuous monitoring for compliance logs, you pick flow logs. Another practical tip: you can combine both tools. For example, use flow logs to identify suspicious IPs, then temporarily enable packet mirroring to capture traffic to those IPs for forensic purposes.
The PCNE exam tests VPC Flow Logs and Packet Mirroring in several distinct ways. Expect multiple-choice questions where you must differentiate between the two services, understand their use cases, and recognise configuration requirements. Key exam topics:
- Differences between VPC Flow Logs and Packet Mirroring: Be able to list what each captures (metadata only vs full packets). Common trap: the exam might describe a scenario and ask 'which service would you use?' They often include a distractor like 'Cloud Logging' or 'Cloud Monitoring' — these are not the same as flow logs or packet mirroring. Flow logs are a feature of VPC, while Cloud Logging is a storage/analysis service. - Flow log fields: Memorise the key fields — source IP, destination IP, source port, destination port, protocol, packets, bytes, start time, end time, and action (ACCEPT/DROP). The exam may ask what field indicates whether the traffic was blocked by a firewall rule. Answer: the 'action' field. - Sampling rates: Flow logs are sampled. The default is 1 per 10 packets. The exam may ask about adjusting the sampling rate to reduce cost (lower sampling) or increase accuracy (higher sampling). - Packet Mirroring source and destination: You must know that the mirror source is a network interface (NIC) and the mirror destination is a target endpoint (like a virtual machine or an HTTPS load balancer). The exam may ask about supported destinations or unsupported ones. - Packet Mirroring limitations: It does not support all regions or instance types. The exam may ask about these limitations. For example, packet mirroring is not supported on certain machine types or in certain VPC subnet configurations. - Cost implications: Flow logs are cheaper because they only capture metadata and sample traffic. Packet Mirroring is more expensive because it copies every packet. The exam may ask you to recommend a solution based on budget. Common exam traps:
- Trap: The question asks for 'real-time monitoring of network traffic content'. A distractor says 'VPC Flow Logs' because it is more familiar. Correct answer: Packet Mirroring, because only it captures the payload. - Trap: The question says 'you need to see all dropped connection attempts for the past month'. A distractor says 'Packet Mirroring' because it sounds thorough. Correct answer: VPC Flow Logs with the action filter set to DROP, because storing months of packet captures is prohibitively expensive and unnecessary. - Trap: The question describes a scenario where you need to 'capture traffic from multiple instances' but does not specify whether you need payloads. If the goal is just metadata (like 'how many connections to the database failed'), flow logs are sufficient. If the goal is payload analysis (like 'what data was sent in the failed requests'), use packet mirroring. - Trap: The exam might present a scenario where a customer wants to 'log all TCP traffic to a specific subnet for 90 days'. Flow logs can do this. Packet mirroring would be overkill and too expensive. Definitions to memorise:
- VPC Flow Log: A feature that captures metadata about network traffic in a VPC. - Packet Mirroring: A feature that copies the full content of packets for deep analysis. - Sampling: Capturing only a fraction of packets to reduce data volume. - Mirror source: The network interface whose traffic is being copied. - Mirror destination: The endpoint that receives the mirrored traffic. - Action field: In flow logs, indicates whether the packet was accepted or dropped by firewall rules. The exam also tests your understanding of the interaction between these services and other Google Cloud services. For example, flow logs can be streamed to Cloud Logging and then used to trigger Cloud Functions or create dashboards in Cloud Monitoring. Packet Mirroring traffic can be sent to a third-party security appliance running on a Compute Engine instance. Knowing these integrations will help you answer questions about 'what happens next' or 'how would you enable this?'
VPC Flow Logs capture only network metadata — source IP, destination IP, ports, protocol, and action — never the payload.
Packet Mirroring copies the full packet, including the payload, for deep forensic analysis and security investigations.
VPC Flow Logs are sampled (typically one log entry per 10 packets) to reduce cost and data volume.
Packet Mirroring is not sampled — it copies every single packet from the mirrored interface, making it expensive.
Use VPC Flow Logs for ongoing monitoring, cost allocation, and identifying dropped connections over long periods.
Use Packet Mirroring for incident response, malware analysis, and any scenario requiring inspection of actual data content.
These come up on the exam all the time. Here's how to tell them apart.
VPC Flow Logs
Captures only metadata (source, destination, port, protocol, action)
Cheaper to store because data is sampled and small
Used for ongoing monitoring, cost allocation, and compliance audits
Packet Mirroring
Captures full packet including payload
Expensive because it copies every packet
Used for deep forensic investigation, malware analysis, and incident response
VPC Flow Logs
Focuses on network traffic metadata at the packet level
Generated by the VPC infrastructure automatically
Data includes fields like source IP, destination IP, port, protocol
Cloud Monitoring (formerly Stackdriver)
Focuses on metrics and alerts from cloud resources (CPU, memory, latency)
Requires configuration of monitoring agents or built-in metrics
Data includes resource utilisation, uptime, and custom metrics
Packet Mirroring
A feature provided by the cloud platform for copying packets
Does not analyse the packets itself — only forwards them
Can be used with any analysis tool or collector
Intrusion Detection System (IDS)
A security tool that analyses network traffic for malicious patterns
Includes built-in signature detection and alerting
Can receive input from Packet Mirroring or direct network feed
Sampling (in Flow Logs)
Captures only a fraction of packets (e.g., 1 in 10)
Reduces storage cost and log volume significantly
May miss rare events or one-off anomalies
Full Capture (in Packet Mirroring)
Captures every single packet without skipping
High storage and bandwidth cost
Ensures no event is missed — essential for forensics
Mistake
VPC Flow Logs capture the actual data in each packet, like the contents of a web request.
Correct
VPC Flow Logs only capture metadata — source IP, destination IP, ports, protocol, and action. They never capture the payload data. Packet Mirroring is the tool for seeing the actual data.
The word 'flow' sounds like a continuous stream of data, so beginners assume it includes everything. It is a natural but incorrect leap. The exam explicitly tests this difference.
Mistake
You can enable VPC Flow Logs on a single virtual machine after it is already running, and it will retroactively show past traffic.
Correct
VPC Flow Logs only start capturing traffic from the moment you enable them. They do not retroactively log past traffic. You must enable them before the traffic you want to capture.
People are used to logging that stores everything (like application logs that keep history). Network flow logs are event-driven and only capture from the point of activation. The exam may ask about 'capturing historical data' to see if you understand this limitation.
Mistake
Packet Mirroring and VPC Flow Logs are interchangeable — you can use either to achieve the same monitoring goal.
Correct
They serve completely different purposes. Flow logs are for metadata, cheap, and good for ongoing monitoring. Packet Mirroring is for full packet capture, expensive, and used for in-depth forensic analysis. Using one for the other's job will either miss important data or waste money.
Cloud vendors sometimes market both as 'network visibility tools', which blurs the distinction. Beginners treat them as synonyms. The exam loves presenting a scenario and asking which tool is appropriate, with both options listed.
Mistake
Enabling VPC Flow Logs will impact the performance of my applications because it is doing extra work on every packet.
Correct
Flow logs are designed to have minimal performance impact. They are processed asynchronously by the cloud provider's infrastructure and do not introduce latency to the actual traffic flow.
Many people assume that any monitoring overhead must slow down the system. The cloud provider handles flow logs off the critical path, so the performance hit is negligible. The exam might ask about performance concerns to test this understanding.
Mistake
Packet Mirroring is always the best choice because it gives you the most data.
Correct
Packet Mirroring gives you the most data, but it is also the most expensive and generates huge volumes. For routine monitoring or compliance logging, VPC Flow Logs are more appropriate. More data is not always better — it is about cost vs. need.
Beginners often think that more data equals better security. But storing every packet for a month is prohibitively expensive and requires massive storage. The exam will test cost-conscious decision-making.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
No. VPC Flow Logs only capture metadata — the source IP, destination IP, ports, protocol, and whether the traffic was allowed or blocked. They never capture the payload. For payload analysis, you need Packet Mirroring.
No, it has minimal performance impact. Flow logs are processed asynchronously by the cloud provider's infrastructure and do not add latency to the actual network traffic.
It depends on your storage destination. You can export flow logs to Cloud Storage, which can keep them indefinitely, or to BigQuery for analysis. Cloud Logging has a default retention period (typically 30 days), but you can configure custom retention.
No, Packet Mirroring is region-specific and may not be available in all zones or for all machine types. You should check the Google Cloud documentation for the latest supported regions and instance types.
Yes, they are independent features and can be enabled simultaneously on the same interface. Flow logs will capture metadata, and Packet Mirroring will capture the full packets, giving you both summary and detailed data.
The action field in a flow log indicates whether the packet was accepted or dropped by the VPC firewall rules. It is a log data point, not a configuration. A firewall rule is the actual security policy that allows or denies traffic. The flow log shows the result of applying the firewall rule.
You've finished VPC Flow Logs and Packet Mirroring. Continue through the PCNE study guide to build a complete picture of the exam.
Done with this chapter?