This section provides examples of fine-grain alert queries that you can use to filter Cloud Logging data. To learn more about query fields specific to Unified Maintenance, see the log schema.
Alert on any new scheduled maintenance
To alert on any new scheduled maintenance, define the logName
for maintenance
events in your project, and a SCHEDULED
state. For example:
log_id("maintenance.googleapis.com/maintenance_events") AND
jsonPayload.state = "SCHEDULED"
Alert when maintenance is scheduled for a specific resource type
To alert on any new scheduled maintenance for a specific resource type, define
the logName
for maintenance events in your project, a SCHEDULED
state, and define
the resource.type
. For example, a Cloud SQL instance:
log_id("maintenance.googleapis.com/maintenance_events") AND
jsonPayload.state = "SCHEDULED" AND
jsonPayload.resource.type = "sqladmin.googleapis.com/Instance"
Alert when any maintenance starts in a specific location
To alert on any new maintenance starting in a specific location, define the
logName
for maintenance events in your project, a STARTED
state, and define
the location. For example, us-central1
:
log_id("maintenance.googleapis.com/maintenance_events") AND
jsonPayload.state = "STARTED" AND
jsonPayload.resource.labels.location = "us-central1"
Alert when maintenance is complete on a specific resource
To alert on any completed maintenance on a specific resource, define the logName
for maintenance events in your project, a COMPLETED
state, and define the
resourceName
. For example, prod-db
:
log_id("maintenance.googleapis.com/maintenance_events") AND
jsonPayload.state = "COMPLETED" AND
jsonPayload.resource.resourceName = "//sqladmin.googleapis.com/projects/proj-1/instances/prod-db"
Alert when there is a change to the scheduled start time of the maintenance
To alert when there is change to the scheduled start time, define the logName
for maintenance events in your project, and check for recent updates to the
timeline.schedule.startTime field
. For example:
log_id("maintenance.googleapis.com/maintenance_events") AND
labels."maintenance.googleapis.com/updated_fields" =~ "maintenanceScheduledStartTime"
What's next
- Log schema overview
- Configure alerts and notifications
- Control maintenance