Configure alerts for snapshot schedules

Linux Windows

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:

  1. Create a log filter to capture scheduled snapshotevents.
  2. Create a metric based off of the log filter thatcounts scheduled snapshot failures.
  3. Create an alert policy to send an alert when there isa scheduled snapshot failure.

Before you begin

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:

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

  1. In the Google Cloud console, go to theLogging > Logs Explorer page.

    Go to the Logs Explorer page

  2. In theFilter by label or text search list, selectConvert to advanced filter.

Convert to advanced filter.

  1. Replace the filter field by entering the following text, replacingPROJECT_ID with your project ID:

    resource.type="gce_disk"logName="projects/PROJECT_ID/logs/cloudaudit.googleapis.com%2Fsystem_event"protoPayload.methodName="ScheduledSnapshots"severity>"INFO"
  2. ClickSubmit Filter.

Create a metric

After you create the log filter, create a metric thatcounts scheduled snapshot failures.

Console

  1. On theLogs Explorer page, clickCreate metric.

  2. In theMetric Editor, enter the following:

    • Name:scheduled_snapshot_failure_count.
    • Description:count of scheduled snapshot failures.
    • Type:Counter
  3. UnderLabels, clickAdd item and enter the following:

    • Name:status
    • Description:status of scheduled snapshot request
    • Label type:String
    • Field name:protoPayload.response.status
  4. ClickDone.

  5. 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

  1. In the Google Cloud console, go to theCloud Logging > Logs-based metrics page.

    Go to the Logs-based metrics page

  2. UnderUser-defined Metrics, find your new metric nameduser/scheduled_snapshot_failure_count.

  3. Click theMoremenu button in this row and selectCreate alert from metric. Thealert policy condition creation page opens.

    User-defined metric.

  4. In theTarget panel, underAggregator, selectnone.

  5. UnderFilter:

    1. ClickAdd a filter.
    2. Selectstatus from the list.
    3. In theValue field, type DONE.
    4. ClickApply.

    Alert filter status.

  6. ClickShow advanced options.

  7. In theAdvanced aggregation pane, click theAligner list and selectsum.

  8. In theConfiguration panel, select the following values:

    • Condition triggers if:Any time series violates
    • Condition:is above
    • Threshold:1
    • For:most recent value

    Configuration panel.

  9. ClickSave.

  10. On theCreate new alerting policy page, enter a policy name.Optionally, you can add notification channels and documentation forthis policy.

  11. ClickSave.

What's next

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.