[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 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)."]]