To create alert policies and filter logs, you must use the Logging query language. The following table details the fields in the
Unified Maintenance resource ResourceMaintenance
. Use these fields to write
query operations for Unified Maintenance resources.
ResourceMaintenance
log schema
Fields | |
---|---|
resource |
MonitoredResource |
resource.type |
string Set to the monitored resource type of the targeted resourc. For example, Cloud SQL instance: cloudsql_database |
resource.labels |
map (key: string, value: string) Labels that uniquely identify a target resource (see a list of labels in monitored resource types). |
labels |
map (key: string, value: string) Key-value pair used to filter logs entries. Possible keys: maintenance.googleapis.com/new_resource_maintenance - set to True for the first log entry for a ResourceMaintenance maintenance.googleapis.com/updated_fields - a list of updated ResourceMaintenance fields, for example: "['state','maintnanceScheduledStartTime','maintenanceScheduledEndTime']" |
insertId |
string A unique identifier for the log entry. |
timestamp |
string (Timestamp format) The time the event described by the log entry occurred. This time is used to compute the log entry's age and to enforce the logs retention period. |
receiveTimestamp |
string (Timestamp format) The time the log entry was received by Logging. |
jsonPayload |
ResourceMaintenance Payload with resource maintenance details. |
jsonPayload.@type |
string Type definition of the payload. Equal to: type.googleapis.com/google.cloud.maintenance.logging.v1beta.ResourceMaintenanceLog |
jsonPayload.name |
string Full resource maintenance name. |
jsonPayload.resource.resourceName |
string Reference to the Consumer resource affected by maintenance (full resource name). |
jsonPayload.resource.location |
string The location of the target resource. See description of the location path parameter. |
jsonPayload.resource.type |
string Type of resource that the maintenance is applicable to. See supported resource types. |
jsonPayload.maintenance |
object Maintenance details. |
jsonPayload.maintenance.maintenanceName |
string Maintenance name. |
jsonPayload.maintenance. title |
string Maintenance title. |
jsonPayload.maintenance. description |
string Description with details about maintenance that are relevant for the Consumer, for example: target release, list of releases that it can be upgraded from, bugs fixed, new features added, how it can affect resources, or disruption SLO. |
jsonPayload.state |
enum State of the maintenance: SCHEDULED - Scheduled for a particular window. For disruptive maintenance it should respect maintenance policy. For example, the available windows, exclusions, and notification period. STARTED - Maintenance is ongoing. CANCELED - No longer planned, typically when other maintenance (e.g. upgrade to newer version) already happened, or the user skipped the maintenance. COMPLETED - Successfully completed. |
jsonPayload.maintenanceScheduledStartTime |
string (RFC 3339 date time format) Scheduled start time of the maintenance. The maintenance will start at schedule.startTime or later, with best effort to finish before schedule.endTime. |
jsonPayload.maintenanceScheduledEndTime |
string (RFC 3339 date time format) An estimated (best effort, not guaranteed) end time of the scheduled maintenance. |
jsonPayload.maintenanceStartTime |
string (RFC 3339 date time format) Actual date when the maintenance started. Field present only after the state changed to STARTED. |
jsonPayload.maintenanceCompleteTime |
string (RFC 3339 date time format) Actual date when the maintenance completed. Field present only after the state changed to COMPLETED. |
jsonPayload.maintenanceCancelTime |
string (RFC 3339 date time format) Actual date when the maintenance completed. Field present only after the state changed to CANCELED. |
Example log fields
The following example shows a ResourceMaintenance
resource.
"insertId": "proj-1-us-west1-db-1-830d851d-2adf-4fb0-8f5b-1e18e16530d9", "timestamp": "2023-09-14T16:00:00Z", "receiveTimestamp": "2023-09-14T16:00:01Z", "logName":"projects/proj-1/logs/maintenance.googleapis.com%2Fmaintenance_events", "resource": { "type":"cloudsql_database", "labels": { "project_id": "proj-1", "database_id":"db-1", "region": "us-west1", }, }, "labels": { "maintenance.googleapis.com/new_resource_maintenance": "False", "maintenance.googleapis.com/updated_fields": "['state','maintnanceScheduledStartTime','maintnanceScheduledEndTime']" }, "jsonPayload": { "@type": "type.googleapis.com/google.cloud.maintenance.logging.v1beta.ResourceMaintenanceLog", "name": "projects/proj-1/locations/us-west1/resourceMaintenances/db-1-a8307daa-5e1f-4974-b6a5-61fceb8331c0", "resource": { "resourceName": "//sqladmin.googleapis.com/projects/proj-1/instances/db-1", "location": "us-west1-a", "type": "sqladmin.googleapis.com/Instance" }, "maintenance": { "maintenanceName": "830d851d-2adf-4fb0-8f5b-1e18e16530d9", "title": "Cloud SQL upgrade to v2", "description": "An upgrade to v2 release. New features... Release notes: https://..." }, "state": "SCHEDULED", "maintenanceScheduledStartTime": "2023-09-21T16:00:00Z", "maintenanceScheduledEndTime": "2023-09-21T20:00:00Z" }
What's next
- Unified Maintenance overview
- Set up Unified Maintenance
- Configure alerts and notifications
- Implement common alert policies