Other Articles

VPC Network – Enable Subnet Flow Logs

Secure Configuration Checks > GCP

This check ensures that VPC Flow Logs are enabled for every subnet. Flow logs record the network traffic that goes to and from your instances.

Check Details

  • Resource: VPC Subnet
  • Check: Enable subnet flow logs
  • Risk: Without flow logs, you cannot review network traffic. Unusual connections and data theft are hard to detect and investigate.

Remediation via Google Cloud Console

  1. Log in to the Google Cloud Console and navigate to VPC network > VPC networks. VPC Networks
  2. Open the Subnets in current project tab. Select the checkbox next to the subnet for which Flow Logs need to be enabled. VPC Subnets
  3. Click Manage flow logs in the toolbar, then click Add new configuration.
  4. Under Configurations - Subnets, click Add a configuration. Enter a configuration name. Create VPC Flow Logs Configuration
  5. Optionally configure the aggregation interval, log filtering and metadata annotations, then click Save.
  6. Repeat these steps for every subnet where Flow Logs are disabled.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and launch Cloud Shell. GCP Cloud Shell
  2. List the subnets that have flow logs turned off:

    gcloud compute networks subnets list \
    --filter="purpose=PRIVATE AND NOT logConfig.enable=true" \
    --format="table(name,region.basename(),network.basename(),logConfig.enable)"
    

    Subnets for load balancer proxies cannot have flow logs, so the list leaves them out.

  3. Enable flow logs on the subnet:

    gcloud compute networks subnets update <SUBNET_NAME> \
    --region=<REGION> \
    --enable-flow-logs
    

    Replace <SUBNET_NAME> with your subnet name and <REGION> with its region, for example us-central1. Repeat for each subnet from the list.

  4. Verify the flow log configuration:

    gcloud compute networks subnets describe <SUBNET_NAME> \
    --region=<REGION> \
    --format="yaml(logConfig)"
    

    The output must show enable: true.

    Verify VPC flow logs

Default Value

By default, flow logs are turned off for new subnets. Flow logs add to your Cloud Logging cost. A lower sampling rate reduces the volume.

Updated on 09 November, 2026