[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[[["\u003cp\u003eThis guide outlines how to configure alerts for failed Dataplex task executions using either the Logs Explorer or the Monitoring API.\u003c/p\u003e\n"],["\u003cp\u003eAlerts can be customized to monitor for failures across all Dataplex tasks or be configured to monitor a specific task by using the appropriate log filters.\u003c/p\u003e\n"],["\u003cp\u003eThe Logs Explorer method involves creating alerts through the Google Cloud console by defining log queries that trigger notifications based on specific error conditions.\u003c/p\u003e\n"],["\u003cp\u003eThe Monitoring API method uses a JSON configuration to define the alert policy, including log filters, notification rate limits, incident autoclose duration, and notification channels, offering a programmatic approach to alert setup.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize alerts by setting the time between notifications and the duration for automatically closing incidents.\u003c/p\u003e\n"]]],[],null,["# Set up alerts and notifications for Dataplex Universal Catalog tasks\n\nThis page describes how to set up alerts for failed job executions of a\n[Dataplex Universal Catalog task](/dataplex/docs/schedule-custom-spark-tasks).\n\nTo set up alerts, you can use the Logs Explorer in the Google Cloud console\nor the Monitoring API.\n\nTerminology\n-----------\n\n- **Incident autoclose duration**: You can close an incident automatically if there are no matching log entries within this duration.\n- **Time between notifications**: You can lower the frequency of repeated notifications by setting a time between the same notification. Log entries that match a filter are skipped during this time. The minimum time you can set is 5 minutes.\n\nSet up notifications using Logs Explorer\n----------------------------------------\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n\n [Go to Logs explorer](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n2. Click the **Show query** toggle.\n\n 1. To set up an alert for a failed job execution of any\n Dataplex Universal Catalog task in a project, type the following query:\n\n severity=ERROR\n resource.type = \"dataplex.googleapis.com/Task\"\n logName = \"projects/\u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e/logs/dataplex.googleapis.com%2Fprocess\"\n jsonPayload.state = \"FAILED\"\n\n 2. To set up an alert for a failed job execution of a specific\n Dataplex Universal Catalog task in a project, type the following query:\n\n severity=ERROR\n resource.type = \"dataplex.googleapis.com/Task\"\n resource.labels.task_id = \u003cvar translate=\"no\"\u003eTASK_ID\u003c/var\u003e\n logName = \"projects/\u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e/logs/dataplex.googleapis.com%2Fprocess\"\n jsonPayload.state = \"FAILED\"\n\n3. Click **Create alert**.\n\n4. In the **Alert Policy Name** field, enter a name for the new alert.\n\n5. In the **Documentation** field, enter the description you want to include in\n the notification. For more information about the content you can include in\n the documentation field of an alerting policy, see\n [Using Markdown and variables in documentation templates](/monitoring/alerts/doc-variables).\n\n6. Click **Next**.\n\n7. Choose the logs you want to include in the alert, and click **Next**.\n\n8. Set the **Time between notifications** and the **Incident autoclose duration** ,\n and click **Next**.\n\n9. Optional: Select a notification channel. For more information about configuring notification\n channels using the Google Cloud console, see [Manage notification channels](/monitoring/support/notification-options).\n\n10. Click **Save**.\n\nSet up notifications using Monitoring API\n-----------------------------------------\n\n1. Optional: Enable the Monitoring API and authorize users to access it. For more information, see [Enable the Monitoring API](/monitoring/api/enable-api#cloud-console).\n2. Optional: Set the roles or permissions needed to create an alerting policy. For more information, see [Authorization required to create alerting policies](/monitoring/alerts#permissions).\n3. Create a notification channel by using either [Google Cloud console](/monitoring/support/notification-options#creating_channels) or [Google Cloud CLI](/monitoring/alerts/using-channels-api#api-create-channels).\n4. Get the `channel_id`:\n\n gcloud beta monitoring channels list\n\n5. Create a `policy.json` file with the following content for\n log-based-alerting-policy:\n\n 1. Set up an alert for a failed job execution of any\n Dataplex Universal Catalog task in a project:\n\n {\n \"displayName\": \"Alert Using Monitoring API\",\n \"documentation\": {\n \"content\": \"Log-based alert in project \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e.\",\n \"mimeType\": \"text/markdown\"\n },\n\n \"conditions\": [\n {\n \"displayName\": \"Log match condition: Failed Job Execution\",\n \"conditionMatchedLog\": {\n \"filter\": \"severity=\\\"ERROR\\\" resource.type = \\\"dataplex.googleapis.com/Task\\\" logName = \\\"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/dataplex.googleapis.com%2Fprocess\\\" jsonPayload.state = \\\"FAILED\\\"\",\n },\n }\n ],\n \"combiner\": \"OR\",\n\n \"alertStrategy\": {\n \"notificationRateLimit\": {\n \"period\": \"300s\"\n },\n \"autoClose\": \"604800s\",\n },\n\n \"notificationChannels\": [\n \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/notificationChannels/\u003cvar translate=\"no\"\u003eCHANNEL_ID\u003c/var\u003e\"\n ]\n }\n\n 2. Set up an alert for a failed job execution for a specific\n Dataplex Universal Catalog task in a project:\n\n {\n \"displayName\": \"Alert Using Monitoring API\",\n \"documentation\": {\n \"content\": \"Log-based alert in project \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e.\",\n \"mimeType\": \"text/markdown\"\n },\n\n \"conditions\": [\n {\n \"displayName\": \"Log match condition: Failed Job Execution\",\n \"conditionMatchedLog\": {\n \"filter\": \"severity=\\\"ERROR\\\" resource.type = \\\"dataplex.googleapis.com/Task\\\" logName = \\\"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/dataplex.googleapis.com%2Fprocess\\\" jsonPayload.state = \\\"FAILED\\\" resource.labels.task_id = \\\"\u003cvar translate=\"no\"\u003eTASK_ID\u003c/var\u003e\\\"\",\n },\n }\n ],\n \"combiner\": \"OR\",\n\n \"alertStrategy\": {\n \"notificationRateLimit\": {\n \"period\": \"300s\"\n },\n \"autoClose\": \"604800s\",\n },\n\n \"notificationChannels\": [\n \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/notificationChannels/\u003cvar translate=\"no\"\u003eCHANNEL_ID\u003c/var\u003e\"\n ]\n }\n\n6. Pass the `policy.json` file to the `gcloud` CLI:\n\n gcloud alpha monitoring policies create --policy-from-file=\"policy.json\"\n\n If successful, the command returns the resource name of the new policy. For\n example:\n\n `Created alert policy [projects/PROJECT_ID/alertPolicies/*POLICY_ID*].`\n\nWhat's next\n-----------\n\n- Learn more about [Cloud Logging](/logging/docs).\n- Learn about [monitoring Dataplex Universal Catalog metrics](/dataplex/docs/monitoring)."]]