From 3138b1eed5fd9734e8584b0f3a158ce0d80b52eb Mon Sep 17 00:00:00 2001 From: Thomas Arrow Date: Mon, 17 Feb 2025 10:07:46 +0000 Subject: [PATCH] tf(prod): clarify production-site-request-count (#1976) This commit tweaks the log based metric to more specifically target just incoming requests rather than also error log lines etc. from nginx This uses a regex that should match an ipv4, a dash, the possible - or $remote_user and the [ at the start of the timestamp. Bug: T385969 --- tf/env/production/monitoring.tf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tf/env/production/monitoring.tf b/tf/env/production/monitoring.tf index 4cad67788..7916ad0f7 100644 --- a/tf/env/production/monitoring.tf +++ b/tf/env/production/monitoring.tf @@ -13,9 +13,7 @@ resource "google_logging_metric" "production-site-request-count" { filter = <<-EOT labels."k8s-pod/app_kubernetes_io/name"="ingress-nginx" resource.type="k8s_container" - -textPayload:"GoogleStackdriverMonitoring" - -textPayload:"cert-manager" - -textPayload:"Widar" + textPayload=~"^\d*\.\d*\.\d*\.\d*\ - (-|\w) \[" EOT label_extractors = { "domain" = "REGEXP_EXTRACT(textPayload, \"\\\\w+ https:\\\\/\\\\/([^\\\\/]+)\")"