Stay organized with collections
Save and categorize content based on your preferences.
This page explains how to configure a log-based alert for vaulted resources
from the Log Explorer page in the Google Cloud console.
The Logs Explorer page guides you through the following steps to create
and edit log-based alerts:
Provide a name and description for the alert.
Choose the logs you want to receive a notification for.
Set the time interval between notifications.
Set the time for automatic closure of incidents.
Specify whom to notify.
You can configure alerts for the job categories: SCHEDULED_BACKUP,
ON_DEMAND_BACKUP, and RESTORE. You can also set alerts for the job status:
SUCCESSFUL, FAILED, SKIPPED, and RUNNING.
You can configure one or more notification channels, such as Google chat, email, SMS,
or chat program channels, to receive notifications when an alert occurs. For instructions,
see Create and manage notification channels.
To notify an alert, you need to have a notification channel.
You can create the notification channel before creating an alert or while creating an alert.
Use the following instructions to create a log-based alert.
In the Google Cloud console, go to the Logs Explorer page.
In the Choose logs to include in the alert section, do the following:
Click Preview logs to check the query and results. You can also edit
the query in this pane, if necessary.
Click Add a label and do the following. The labels
let you customize notifications and make them more informative.
In the Display name field, enter a name for the label.
From the Log field name list, select a log field name. These fields
are displayed based on the selected query result.
In the Regular expression field, enter an expression to extract
a value from the field that must contain exactly one regular expression group.
Click Next.
In the Set notification frequency and autoclose duration section, do the following:
From the Time between notifications list, select the minimum time between
notifications. This value lets you control the number of notifications you
get from this alert if it is triggered multiple times.
From the Incident autoclose duration list, select a duration after which
the incident to be closed automatically when matching log entries are absent.
Click Next.
From the Notification channels list, select one or more notification
channels for your alert. If you don't have a notification channel configured,
click Manage notification channels to create one. For instructions,
see Create and manage notification channels.
Click Save.
Test the log-based alert
To test the log-based alert you created, you can manually write a log entry
that matches the query.
Use the following instructions to write the log entry.
In the Request body field, replace the content with
the log entry you copied in the previous step.
Click Execute. If prompted, follow the authentication flow.
If the logEntries.write call is successful, then you get an HTTP 200 response
code and an empty response body, {}. For more information about APIs Explorer,
see Using the APIs Explorer.
The log entry matches the filter specified for the alert in the following ways:
The logName value specifies the backup or restore job logs in your cloud project.
The jsonPayload contains a failed job category, SCHEDULED_BACKUP, which
indicates that the log is related to a backup scheduled by a backup plan.
The jsonPayload contains the field job status as FAILED, which
signifies that the job is failed.
After you write the log entry, the following sequence occurs:
The new log entry appears in the Logs Explorer and triggers the alert.
An incident is opened in the Cloud Monitoring page.
You receive a notification for the incident. If you configured an email
notification channel, then the notification displays.
You can click View incident in the email to see the incident in the
Cloud Monitoring page. For more information about incidents including
how to acknowledge and close them, see Manage incidents for log-based alerts.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003eThis page provides instructions on how to configure log-based alerts for vaulted resources using the \u003cstrong\u003eLogs Explorer\u003c/strong\u003e in the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eYou can set up alerts for specific job categories like \u003ccode\u003eSCHEDULED_BACKUP\u003c/code\u003e, \u003ccode\u003eON_DEMAND_BACKUP\u003c/code\u003e, and \u003ccode\u003eRESTORE\u003c/code\u003e, as well as job statuses like \u003ccode\u003eSUCCESSFUL\u003c/code\u003e, \u003ccode\u003eFAILED\u003c/code\u003e, \u003ccode\u003eSKIPPED\u003c/code\u003e, and \u003ccode\u003eRUNNING\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe alert configuration includes setting an alert name, choosing the relevant logs, defining notification frequency, setting the incident auto-close duration, and adding notification channels like Google Chat, email, or SMS.\u003c/p\u003e\n"],["\u003cp\u003eThe process of creating an alert involves defining a query in the \u003cstrong\u003eLogs Explorer\u003c/strong\u003e, setting up an \u003cstrong\u003eAlert Policy\u003c/strong\u003e, adding labels, and managing notification frequency and incident auto-close.\u003c/p\u003e\n"],["\u003cp\u003eThe page also contains instructions on how to test the created log-based alert by manually writing a log entry that triggers the defined criteria.\u003c/p\u003e\n"]]],[],null,["# Configure a log-based alert for vaulted resources\n\nThis page explains how to configure a log-based alert for vaulted resources\nfrom the **Log Explorer** page in the Google Cloud console.\n\nThe **Logs Explorer** page guides you through the following steps to create\nand edit log-based alerts:\n\n- Provide a name and description for the alert.\n- Choose the logs you want to receive a notification for.\n- Set the time interval between notifications.\n- Set the time for automatic closure of incidents.\n- Specify whom to notify.\n\nYou can configure alerts for the job categories: `SCHEDULED_BACKUP`,\n`ON_DEMAND_BACKUP`, and `RESTORE`. You can also set alerts for the job status:\n`SUCCESSFUL`, `FAILED`, `SKIPPED`, and `RUNNING`.\n\nYou can configure one or more notification channels, such as Google chat, email, SMS,\nor chat program channels, to receive notifications when an alert occurs. For instructions,\nsee [Create and manage notification channels](/monitoring/support/notification-options).\n\nBefore you begin\n----------------\n\n- [Assign permissions for log-based alerting policies](/logging/docs/access-control#lba-permissions).\n\nCreate a log-based alert\n------------------------\n\nTo notify an alert, you need to have a [notification channel](/monitoring/support/notification-options).\nYou can create the notification channel before creating an alert or while creating an alert.\n\nUse the following instructions to create a log-based alert.\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. In the **Query** pane define the alert on which you want to be notified.\n\n The following query is an example to get notified whenever a scheduled backup job fails. \n\n logName=\"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/backupdr.googleapis.com%2Fbdr_backup_restore_jobs\"\n jsonPayload.jobCategory=\"SCHEDULED_BACKUP\"\n jsonPayload.jobStatus=\"FAILED\"\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the name of the project.\n3. In the header of the **Query results** pane, click **Create alert**.\n\n4. In the **Alert details** section, do the following:\n\n 1. In the **Alert Policy Name** field, enter a name for your alert. This name gets displayed in the notification header.\n 2. In the **Documentation** field, enter the description for the alert. For information about how you can format and refine the content of this field, see [Using Markdown and variables in documentation templates](/monitoring/alerts/doc-variables).\n5. Click **Next**.\n\n6. In the **Choose logs to include in the alert** section, do the following:\n\n 1. Click **Preview logs** to check the query and results. You can also edit the query in this pane, if necessary.\n 2. Click **Add a label** and do the following. The [labels](/monitoring/alerts/labels)\n let you customize notifications and make them more informative.\n\n 1. In the **Display name** field**,** enter a name for the label.\n 2. From the **Log field name** list, select a log field name. These fields are displayed based on the selected query result.\n 3. In the **Regular expression** field, enter an expression to extract a value from the field that must contain exactly one regular expression group.\n7. Click **Next**.\n\n8. In the **Set notification frequency and autoclose duration** section, do the following:\n\n 1. From the **Time between notifications** list, select the minimum time between notifications. This value lets you control the number of notifications you get from this alert if it is triggered multiple times.\n 2. From the **Incident autoclose duration** list, select a duration after which the incident to be closed automatically when matching log entries are absent.\n9. Click **Next**.\n\n10. From the **Notification channels** list, select one or more notification\n channels for your alert. If you don't have a notification channel configured,\n click **Manage notification channels** to create one. For instructions,\n see [Create and manage notification channels](/monitoring/support/notification-options).\n\n11. Click **Save**.\n\nTest the log-based alert\n------------------------\n\nTo test the log-based alert you created, you can manually write a log entry\nthat matches the query.\n\nUse the following instructions to write the log entry.\n\n1. Go to the [`logEntries.write`](/logging/docs/reference/v2/rest/v2/entries/write) reference page.\n\n [Go to logEntries.write](/logging/docs/reference/v2/rest/v2/entries/write)\n2. Configure the following log entry by changing the \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n variable to your project ID.\n\n {\n \"entries\": [\n {\n \"jsonPayload\": {\n \"jobCategory\": \"SCHEDULED_BACKUP\",\n \"jobStatus\": \"FAILED\"\n }\n }\n ],\n \"resource\": {\n \"type\": \"backupdr.googleapis.com/BackupDRProject\"\n },\n \"logName\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/backupdr.googleapis.com%2Fbdr_backup_restore_jobs\"\n }\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the name of the project.\n3. Copy the log entry you configured previously.\n\n4. In the **Try this API** pane, follow these steps:\n\n 1. In the **Request body** field, replace the content with the log entry you copied in the previous step.\n 2. Click **Execute**. If prompted, follow the authentication flow.\n5. If the `logEntries.write` call is successful, then you get an HTTP `200` response\n code and an empty response body, `{}`. For more information about **APIs Explorer** ,\n see [Using the APIs Explorer](/monitoring/api/apis-explorer).\n\n The log entry matches the filter specified for the alert in the following ways:\n - The `logName` value specifies the backup or restore job logs in your cloud project.\n - The `jsonPayload` contains a failed job category, `SCHEDULED_BACKUP`, which indicates that the log is related to a backup scheduled by a backup plan.\n - The `jsonPayload` contains the field job status as `FAILED`, which signifies that the job is failed.\n6. After you write the log entry, the following sequence occurs:\n\n 1. The new log entry appears in the Logs Explorer and triggers the alert.\n 2. An incident is opened in the **Cloud Monitoring** page.\n 3. You receive a notification for the incident. If you configured an email\n notification channel, then the notification displays.\n\n You can click **View incident** in the email to see the incident in the\n **Cloud Monitoring** page. For more information about incidents including\n how to acknowledge and close them, see [Manage incidents for log-based alerts](/logging/docs/alerting/log-based-incidents)."]]