Stay organized with collectionsSave and categorize content based on your preferences.
Access flow logs
This page describes how to access flow logs by using Cloud Logging.
Access flow logs in the Logs Explorer
VPC Flow Logs writes logs to the Google Cloud project of the log
reporter. You can view flow logs in theLogs Explorer.
VPC Flow Logs uses the following logs to collect log entries:
For all other VPC Flow Logs configurations, view thenetworkmanagement.googleapis.com/vpc_flowslog. This log collects
log entries for Virtual Private Cloud (VPC) networks
(Preview), subnets
(Preview), VLAN attachments for
Cloud Interconnect, and Cloud VPN tunnels.
To view flow logs in a Google Cloud project by using resource filters, see the
following sections. You can also view these logs by using Logs Explorer
queries, as described inFilter flow logs by using queries.
View flow logs for all subnets (compute.googleapis.com/vpc_flows)
In the Google Cloud console, go to theLogs Explorerpage.
If you don't see the query editor field in theQuerypane, click theShow querytoggle.
In the query editor field, enter a query:
If youenabledVPC Flow Logs for a subnet by using the Compute Engine API,
to view flow logs, the query must targetcompute.googleapis.com. For example, enter the following query, replacingPROJECT_IDwith your Google Cloud project ID andSUBNET_NAMEwith your subnet:
For all other queries, the query must targetnetworkmanagement.googleapis.com. For example,
to view flow logs for a specific source Cloud VPN tunnel,
enter the following query:
Examples of Logs Explorer queries for VPC Flow Logs
The following table provides examples of Logs Explorer queries that you can
run to view your flow logs in a Google Cloud project.
The examples in theQueries for the networkmanagement.googleapis.com/vpc_flowssection
assume that each resource is logged by a single
VPC Flow Logs configuration. If you use multiple
VPC Flow Logs configurations per resource, specify the
configuration that you want to query to exclude duplicate logs
from the query results. You can also specify multiple configurations
in a query.
Logs you want to view
Query
All flow logs
resource.type=("gce_subnetwork" OR "vpc_flow_logs_config")
logName=("projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows" OR
"projects/PROJECT_ID/logs/networkmanagement.googleapis.com%2Fvpc_flows")
Queries for thecompute.googleapis.com/vpc_flowslog
resource.type="gce_subnetwork"
logName="projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows"
(jsonPayload.src_instance.vm_name="VM_NAME" OR
jsonPayload.dest_instance.vm_name="VM_NAME")
Logs for a specific Google Kubernetes Engine (GKE) cluster
resource.type="gce_subnetwork"
logName="projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows"
(jsonPayload.src_gke_details.cluster.cluster_name="CLUSTER_NAME" OR
jsonPayload.dest_gke_details.cluster.cluster_name="CLUSTER_NAME")
Logs for only egress traffic from a subnet
resource.type="gce_subnetwork"
logName="projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows" AND
jsonPayload.reporter="SRC" AND
jsonPayload.src_vpc.subnetwork_name="SUBNET_NAME" AND
(jsonPayload.dest_vpc.subnetwork_name!="SUBNET_NAME"
OR NOT jsonPayload.dest_vpc.subnetwork_name:*)
Logs for all egress traffic from a Virtual Private Cloud (VPC) network
resource.type="gce_subnetwork"
logName="projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows" AND
jsonPayload.reporter="SRC" AND
jsonPayload.src_vpc.vpc_name="VPC_NAME" AND
(jsonPayload.dest_vpc.vpc_name!="VPC_NAME" OR NOT jsonPayload.dest_vpc:*)
CONFIG_NAME: the name of the VPC Flow Logs
configuration
REGION: the region of the VLAN attachment or
Cloud VPN tunnel
NAME: the name of the Cloud VPN tunnel
Route logs to BigQuery, Pub/Sub, and custom targets
You can route flow logs from Logging to a destination
of your choice as described in theRouting and storage overviewin the Logging
documentation.
Refer to the previous section for example filters.
Troubleshooting
Novpc_flowsappear in Logging for thegce_subnetworkresource
Confirm that logging isenabledfor the given
subnet.
VPC flows are only supported for VPC networks.
If you have alegacy network, you don't see any logs.
InShared VPCnetworks, logs only appear in
the host project, not the service projects. Make sure that you look for the
logs in the host project.
Logging exclusion filters block specified logs.
Make sure that there are no exclusion rules that discard VPC Flow Logs:
In themore_vertMore actionsmenu for your logging bucket, clickView sink details.
Make sure that there are no exclusion rules that might discard VPC Flow Logs.
Use the Google Cloud CLI or API to determine if alog
filteringconfiguration is
filtering all the traffic in a given subnet. For example, iffilterExpris set tofalse, you don't see any logs.
No RTT or byte values on some of the logs
RTT measurements may be missing if not enough packets were sampled to
capture RTT. This is more likely to happen for low volume connections.
RTT values are available only for TCP flows reported from VMs.
Some packets are sent with no payload. If header-only packets were sampled,
the bytes value will be 0.
Some flows are missing
Ingress packets are sampled after ingressVPC firewall rules. Make sure that
there aren't any ingress firewall rules that deny the packets that you expect
to be logged. If you're not sure whether VPC
firewall rules are blocking ingress packets, you can enableFirewall Rules Loggingand
inspect the logs.
Only TCP, UDP, ICMP, ESP, and GRE protocols are supported. VPC Flow Logs
does not support any other protocols.
Logsare sampled. Some packets in very
low volume flows might be missed.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Access flow logs\n================\n\nThis page describes how to access flow logs by using Cloud Logging.\n\nAccess flow logs in the Logs Explorer\n-------------------------------------\n\nVPC Flow Logs writes logs to the Google Cloud project of the log\nreporter. You can view flow logs in the\n[Logs Explorer](/logging/docs/view/logs-explorer-interface).\nVPC Flow Logs uses the following logs to collect log entries:\n\n- The `compute.googleapis.com/vpc_flows` log collects log entries for subnets. View this log if you [enabled VPC Flow Logs by using the Compute Engine API](/vpc/docs/using-flow-logs#compute-engine).\n- For all other VPC Flow Logs configurations, view the `networkmanagement.googleapis.com/vpc_flows` log. This log collects log entries for Virtual Private Cloud (VPC) networks ([Preview](/products#product-launch-stages)), subnets ([Preview](/products#product-launch-stages)), VLAN attachments for Cloud Interconnect, and Cloud VPN tunnels.\n\n### Configure IAM\n\nTo configure access control for logging, see the\n[access control guide for Logging](/logging/docs/access-control#permissions_and_roles).\n\n### View flow logs by using resource filters\n\nTo view flow logs in a Google Cloud project by using resource filters, see the\nfollowing sections. You can also view these logs by using Logs Explorer\nqueries, as described in\n[Filter flow logs by using queries](#flow-logs-queries).\n\n#### View flow logs for all subnets (`compute.googleapis.com/vpc_flows`)\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. Click **All resources**.\n\n3. In the **Select resource** list, click **Subnetwork** and then click\n **Apply**.\n\n4. Click **All log names**.\n\n5. In the **Select log names** list, find **Compute Engine** , click\n **vpc_flows** , and then click **Apply**.\n\n#### View flow logs for a specific subnet (`compute.googleapis.com/vpc_flows`)\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. Click **All resources**.\n\n3. In the **Select resource** list, click **Subnetwork**.\n\n4. In the **Subnetwork ID** list, select the subnet and then click\n **Apply**.\n\n5. Click **All log names**.\n\n6. In the **Select log names** list, find **Compute Engine** , click\n **vpc_flows** , and then click **Apply**.\n\n#### View flow logs for all resources (`networkmanagement.googleapis.com/vpc_flows`)\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. Click **All resources**.\n\n3. In the **Select resource** list, click **VPC Flow Logs Config** and\n then click **Apply**.\n\n#### View flow logs for a specific configuration (`networkmanagement.googleapis.com/vpc_flows`)\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. Click **All resources**.\n\n3. In the **Select resource** list, click **VPC Flow Logs Config** and\n select the VPC Flow Logs configuration that you want to view.\n\n4. Click **Apply**.\n\n### Filter flow logs by using queries\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. If you don't see the query editor field in the **Query** pane, click the\n **Show query** toggle.\n\n3. In the query editor field, enter a query:\n\n - If you\n [enabled](/vpc/docs/using-flow-logs#compute-engine)\n VPC Flow Logs for a subnet by using the Compute Engine API,\n to view flow logs, the query must target\n `compute.googleapis.com`. For example, enter the following query, replacing\n \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project ID and\n \u003cvar translate=\"no\"\u003eSUBNET_NAME\u003c/var\u003e with your subnet:\n\n ```\n resource.type=\"gce_subnetwork\"\n logName=\"projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows\"\n resource.labels.subnetwork_name=\"SUBNET_NAME\"\n ```\n - For all other queries, the query must target\n `networkmanagement.googleapis.com`. For example,\n to view flow logs for a specific source Cloud VPN tunnel,\n enter the following query:\n\n ```\n resource.type=\"vpc_flow_logs_config\"\n logName=\"projects/PROJECT_ID/logs/networkmanagement.googleapis.com%2Fvpc_flows\"\n jsonPayload.reporter=\"src_gateway\"\n labels.target_resource_name=\"projects/PROJECT_ID/regions/REGION/vpnTunnels/NAME\"\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the Google Cloud project ID\n - \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region of the Cloud VPN tunnel\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of the Cloud VPN tunnel\n\n For more examples of queries that you can run to view your flow logs, see\n [Examples of Logs Explorer queries for VPC Flow Logs](#example-queries).\n4. Click **Run query**.\n\n#### Examples of Logs Explorer queries for VPC Flow Logs\n\nThe following table provides examples of Logs Explorer queries that you can\nrun to view your flow logs in a Google Cloud project.\n\nThe examples in the\n*Queries for the networkmanagement.googleapis.com/vpc_flows* section\nassume that each resource is logged by a single\nVPC Flow Logs configuration. If you use multiple\nVPC Flow Logs configurations per resource, specify the\nconfiguration that you want to query to exclude duplicate logs\nfrom the query results. You can also specify multiple configurations\nin a query.\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID\n- \u003cvar translate=\"no\"\u003eSUBNET_NAME\u003c/var\u003e: the name of the subnet\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM\n- \u003cvar translate=\"no\"\u003eSUBNET_RANGE\u003c/var\u003e: a CIDR range, such as `192.168.1.0/24`\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the GKE cluster\n- \u003cvar translate=\"no\"\u003eVPC_NAME\u003c/var\u003e: the name of the VPC network\n- \u003cvar translate=\"no\"\u003ePORT1\u003c/var\u003e and \u003cvar translate=\"no\"\u003ePORT2\u003c/var\u003e: the destination ports\n- \u003cvar translate=\"no\"\u003ePROTOCOL\u003c/var\u003e: the communication protocol\n- \u003cvar translate=\"no\"\u003eCONFIG_NAME\u003c/var\u003e: the name of the VPC Flow Logs configuration\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region of the VLAN attachment or Cloud VPN tunnel\n- \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of the Cloud VPN tunnel\n\nRoute logs to BigQuery, Pub/Sub, and custom targets\n---------------------------------------------------\n\nYou can route flow logs from Logging to a destination\nof your choice as described in the\n[Routing and storage overview](/logging/docs/routing/overview) in the Logging\ndocumentation.\nRefer to the previous section for example filters.\n\nTroubleshooting\n---------------\n\n### No `vpc_flows` appear in Logging for the `gce_subnetwork` resource\n\n- Confirm that logging is [enabled](/vpc/docs/using-flow-logs#enable-logging-existing) for the given subnet.\n- VPC flows are only supported for VPC networks. If you have a [legacy network](/vpc/docs/legacy), you don't see any logs.\n- In [Shared VPC](/vpc/docs/shared-vpc) networks, logs only appear in the host project, not the service projects. Make sure that you look for the logs in the host project.\n- Logging exclusion filters block specified logs. Make sure that there are no exclusion rules that discard VPC Flow Logs:\n 1. Go to [Log router](https://console.cloud.google.com/logs/router).\n 2. In the more_vert **More actions** menu for your logging bucket, click **View sink details**.\n 3. Make sure that there are no exclusion rules that might discard VPC Flow Logs.\n- Use the Google Cloud CLI or API to determine if a [log\n filtering](/vpc/docs/about-flow-logs-records#filtering) configuration is filtering all the traffic in a given subnet. For example, if `filterExpr` is set to `false`, you don't see any logs.\n\n### No RTT or byte values on some of the logs\n\n- RTT measurements may be missing if not enough packets were sampled to capture RTT. This is more likely to happen for low volume connections.\n- RTT values are available only for TCP flows reported from VMs.\n- Some packets are sent with no payload. If header-only packets were sampled, the bytes value will be 0.\n\n### Some flows are missing\n\n- Ingress packets are sampled after ingress [VPC firewall rules](/firewall/docs/firewalls). Make sure that there aren't any ingress firewall rules that deny the packets that you expect to be logged. If you're not sure whether VPC firewall rules are blocking ingress packets, you can enable [Firewall Rules Logging](/firewall/docs/firewall-rules-logging) and inspect the logs.\n- Only TCP, UDP, ICMP, ESP, and GRE protocols are supported. VPC Flow Logs does not support any other protocols.\n- Logs [are sampled](/vpc/docs/flow-logs#log-sampling). Some packets in very low volume flows might be missed.\n\n### Missing GKE annotations in some logs\n\nMake sure that your GKE cluster is a [supported version](/kubernetes-engine/docs/release-schedule).\n\n### Missing logs for some GKE flows\n\nMake sure [Intranode\nvisibility](/kubernetes-engine/docs/how-to/intranode-visibility) is enabled in\nthe cluster. Otherwise, flows between Pods on the same node are not logged.\n\nWhat's next\n-----------\n\n- View [Logging](/logging/docs) documentation\n- View [Logging sinks](/logging/docs/export/configure_export_v2) documentation\n- Analyze flow logs in [Flow Analyzer](/network-intelligence-center/docs/flow-analyzer/overview)"]]