Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Here’s how to enable VPC Route Logging for a GCP VPC network via the GCP Console:
-
Go to VPC networks
- In the Google Cloud console, go to:
Navigation menu (☰) → VPC network → VPC networks
- In the Google Cloud console, go to:
-
Select the VPC network
- Click the name of the VPC network that contains the subnet(s) you want to enable route logging for.
-
Open the Subnets list
- In the VPC network details page, go to the Subnets tab.
- Find the subnet where you want to enable route logging.
- Click the Subnet name to open its details.
-
Edit the subnet
- At the top of the subnet details page, click Edit.
-
Enable Route Logging
- Scroll down to the Logs section.
- You should see options such as:
- VPC flow logs
- Route logs
- Set Route logs to On.
- (Optional but recommended) Adjust:
- Aggregation interval
- Sampling (e.g., 1.0 for all)
- Metadata level
- Filter (All, Include, or Exclude certain traffic)
-
Save changes
- Scroll down and click Save.
-
Verify logs in Cloud Logging
- Go to
Navigation menu (☰) → Logging → Logs Explorer. - In the query builder, choose:
- Resource type:
gce_subnetworkorgce_instance(depending how you want to filter) - Log name typically includes:
vpc_routeor similar, depending on UI changes.
- Resource type:
- Run the query and confirm that route logs are appearing.
- Go to
Using CLI
Using CLI
To address “VPC Network Route Logging” findings in GCP, what most tools are actually flagging is the lack of VPC Flow Logs on subnets. You remediate this by enabling flow logs on each subnet via
Look for subnets where
Replace:
Examples:Common values:
Confirm
If your finding truly refers to a different, specific “route logging” feature (e.g., from a particular security tool), share the exact tool / rule ID and I can tailor the exact
gcloud.Below are step‑by‑step CLI instructions.1. List all subnets and see which have Flow Logs disabled
enableFlowLogs is False or empty.2. Enable VPC Flow Logs on a specific subnet
Basic enablement with default settings:SUBNET_NAMEwith your subnet name.REGIONwith the subnet’s region (e.g.us-central1).
3. (Optional) Configure advanced logging options
If you want finer control (recommended for production), use:--logging-aggregation-interval:interval-5-min,interval-10-min,interval-15-min,interval-30-min,interval-1-min
--logging-flow-sampling:0.0–1.0(e.g.0.5= 50%,0.005= 0.5%)
--logging-metadata:INCLUDE_ALL_METADATA,EXCLUDE_ALL_METADATA,CUSTOM_METADATA
4. Verify that Flow Logs are enabled
enableFlowLogs: true and that logConfig matches your desired settings.5. Repeat for all required subnets
You can loop through all subnets in a network:If your finding truly refers to a different, specific “route logging” feature (e.g., from a particular security tool), share the exact tool / rule ID and I can tailor the exact
gcloud commands.Using Python
Using Python
To remediate “VPC Network Route Logging” findings in GCP, you typically enable VPC Flow Logs on all subnets of the affected VPC network. These logs provide route-level visibility (next hop, route, etc.) via Cloud Logging.Below is how to do this using Python and the Compute Engine API.
1. Prerequisites
- Install libraries:
- Make sure your environment is authenticated, e.g.:
- Ensure the account has:
roles/compute.networkAdmin(or equivalent custom role)
2. Python script to enable VPC Flow Logs on all subnets in a VPC
3. What this achieves
- Enumerates all subnetworks in the project.
- Filters those in the specified VPC network.
- For each subnetwork, enables
enableFlowLogsand configures alogConfig, which results in flow + route logging going to Cloud Logging.
aggregationInterval, flowSampling, and metadata as per your org’s logging/volume requirements.Using Terraform
Using Terraform

