Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Help setting up an alert

I tried creating an alert using Monitoring and Logging, but when I tried to log metrics for some resources like BigQuery or Kubernetes, it returned too many logs. My question is, does anyone know how I can debug this so it logs correctly? The idea was to create an alert every time a resource was created in the project.

protoPayload.@type="type.googleapis.com/google.cloud.audit.AuditLog"
protoPayload.methodName=~".*insert.*|.*create.*"

0 1 191
1 REPLY 1

Hi @Er_jut, your query is too broad, this is why you receive too many logs. Instead of using regular expressions (.*insert.*, .*create.*), use the exact method names for resource creation. You should identify the specific resource types you want to monitor and then try to filter in a better way...for example for CloudSQL resources:

--------

protoPayload.@type="type.googleapis.com/google.cloud.audit.AuditLog" protoPayload.methodName="cloudsql.instances.create" resource.type="cloudsql_instance"

-----

Top Labels in this Space
Top Solution Authors