# network-flow-logs / gcp / t1 "Standard" # # Flow logs kept for your chosen period in their own bucket, queryable in Log # Analytics and, through a linked dataset, from BigQuery. # # Flow logs also land in the _Default bucket for its 30 days, so the first # month is stored twice. Exclude them from _Default in the Log Router if that # cost matters. resource "google_logging_project_bucket_config" "flows" { project = var.project_id location = "global" bucket_id = "vpc-flow-logs" retention_days = var.retention_days enable_analytics = true description = "VPC flow logs, queryable with SQL." } resource "google_logging_project_sink" "flows" { project = var.project_id name = "vpc-flow-logs" destination = "logging.googleapis.com/${google_logging_project_bucket_config.flows.id}" filter = "logName:\"compute.googleapis.com%2Fvpc_flows\"" } resource "google_logging_linked_dataset" "flows" { count = var.bigquery_dataset == "" ? 0 : 1 link_id = var.bigquery_dataset bucket = google_logging_project_bucket_config.flows.bucket_id parent = "projects/${var.project_id}" location = "global" description = "Read-only view of the flow log bucket in BigQuery." }