Configure alerts for snapshot schedules Stay organized with collections Save and categorize content based on your preferences.
You cancreate a custom metricto raise alerts or provide information to troubleshoot problems with scheduledsnapshots.
For example, to set up an alert for scheduled snapshot failures, use thefollowing procedure:
- Create a log filter to capture scheduled snapshotevents.
- Create a metric based off of the log filter thatcounts scheduled snapshot failures.
- Create an alert policy to send an alert when there isa scheduled snapshot failure.
Before you begin
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Required roles and permissions
To get the permissions that you need to create a snapshot schedule, ask your administrator to grant you the following IAM roles on the project:
- Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1) - To connect to a VM that can run as a service account:Service Account User (v1) (
roles/iam.serviceAccountUser)
For more information about granting roles, seeManage access to projects, folders, and organizations.
You might also be able to get the required permissions throughcustom roles or otherpredefined roles.
Create a log filter
Create a log filter to capture scheduled snapshot events.
Console
In the Google Cloud console, go to theLogging > Logs Explorer page.
In theFilter by label or text search list, selectConvert to advanced filter.

Replace the filter field by entering the following text, replacing
PROJECT_IDwith your project ID:resource.type="gce_disk"logName="projects/PROJECT_ID/logs/cloudaudit.googleapis.com%2Fsystem_event"protoPayload.methodName="ScheduledSnapshots"severity>"INFO"ClickSubmit Filter.
Create a metric
After you create the log filter, create a metric thatcounts scheduled snapshot failures.
Console
On theLogs Explorer page, clickCreate metric.
In theMetric Editor, enter the following:
- Name:
scheduled_snapshot_failure_count. - Description:
count of scheduled snapshot failures. - Type:
Counter
- Name:
UnderLabels, clickAdd item and enter the following:
- Name:
status - Description:
status of scheduled snapshot request - Label type:
String - Field name:
protoPayload.response.status
- Name:
ClickDone.
ClickCreate Metric.
Create an alert policy
After you create the metric, create an alert policy to send an alert whenthere is a scheduled snapshot failure.
Console
In the Google Cloud console, go to theCloud Logging > Logs-based metrics page.
UnderUser-defined Metrics, find your new metric named
user/scheduled_snapshot_failure_count.Click theMoremenu button in this row and selectCreate alert from metric. Thealert policy condition creation page opens.

In theTarget panel, underAggregator, selectnone.
UnderFilter:
- ClickAdd a filter.
- Selectstatus from the list.
- In theValue field, type DONE.
- ClickApply.

ClickShow advanced options.
In theAdvanced aggregation pane, click theAligner list and selectsum.
In theConfiguration panel, select the following values:
- Condition triggers if:
Any time series violates - Condition:
is above - Threshold:
1 - For:
most recent value

- Condition triggers if:
ClickSave.
On theCreate new alerting policy page, enter a policy name.Optionally, you can add notification channels and documentation forthis policy.
ClickSave.
What's next
- Learn about snapshot schedule frequencies, retention policies, and namingrules inAbout snapshot schedules for disks.
- Learn aboutdisk snapshots.
- Learn how tocreate scheduled snapshots for disks.
- Learn how toview logs.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.