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 resource. 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 Identifier. The name of the resourceMaintenance resource. Format: "projects/{project}/locations/{location}/resourceMaintenance/{resource-maintenance-id}" |
jsonPayload.resource.resourceName |
string Output only. Name is the reference to the consumer resource affected by the maintenance. For available values, see Asset names. |
jsonPayload.resource.location |
string Output only. The location of the resource. Format: us-central1 . |
jsonPayload.resource.type |
string Output only. The type of the resource. For available values, see resource types of supported services. |
jsonPayload.maintenance |
object Output only. The details of the maintenance. |
jsonPayload.maintenance.maintenanceName |
string The name of the corresponding maintenance resource following the standard naming scheme: "{maintenance-id}" . |
jsonPayload.maintenance.title |
string Output only. The title of the maintenance. |
jsonPayload.maintenance. description |
string Output only. The description of the maintenance. |
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.CANCELLED - No longer planned, typically when other maintenance (e.g. upgrade to newer version) already happened, or the user skipped the maintenance.SUCCEEDED - Successfully completed. |
jsonPayload.maintenanceScheduledStartTime |
string Output only. The time when the maintenance on the resource is SCHEDULED .Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" . |
jsonPayload.maintenanceScheduledEndTime |
string Output only. The time when the maintenance on the resource was scheduled to end. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" . |
jsonPayload.maintenanceStartTime |
string Output only. The time when the resource maintenance has STARTED .Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" . |
jsonPayload.maintenanceEndTime |
string Output only. The time when the resource maintenance has SUCCEEDED .Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" . |
jsonPayload.maintenanceCancelTime |
string Output only. The time when the resource maintenance was CANCELLED .Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30" . |
jsonPayload.userControllable |
boolean Output only. Indicates whether the user has some control over that maintenance, either proactively before maintenance was scheduled with maintenance policy or with reactive controls after it was scheduled (see controls field). |
jsonPayload.controls |
object (MaintenanceControl )Output only. The controls of the maintenance. |
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", "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