Configure and manage notifications

You can configure Error Reporting to send error notifications to selected Cloud Monitoring notification channels.

Error Reporting sends notifications in the following cases:

  • When an error first occurs in a Google Cloud project, and it can't be grouped with previous errors.

  • If an error that was marked as Resolved reoccurs.

Manage notification channels

You create, edit, and delete notification channels in Monitoring. After you have created notification channels, you can configure Error Reporting to use them.

Error Reporting lets you select from four types of notification channels: email, mobile, Slack, and Webhooks.

Before you begin

To get the permissions that you need to view and configure notification channels by using the Google Cloud console, ask your administrator to grant you the Monitoring Editor (roles/monitoring.editor) IAM role on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

For more information about Cloud Monitoring roles, see Control access with Identity and Access Management.

Create notification channel

To create a notification channel by using the Google Cloud console, follow the channel-specific instructions contained in the following table:

Email

To add an email notification channel, do the following:

  1. In the Google Cloud console, go to the  Alerting page:

    Go to Alerting

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  2. Click Edit notification channels.
  3. In the Email section, click Add new.
  4. Enter a single email address and a description.
  5. Click Save.

If you use a group email address as the notification channel for an alerting policy, then configure the group to accept mail from ErrorReportingNotifications-noreply@google.com.

Mobile App

Use the Google Cloud console Mobile App to monitor your Google Cloud console resources and Monitoring information from anywhere. Google Cloud console Mobile App notifications are either sent to a specific device or to a specific user:

List of Google Cloud console Mobile App notification channels.

  • Device indicates that notifications are sent only to the specific device that created the notification channel. For device-scoped notification channels, the Display name field includes device information.
  • User indicates that the notifications are sent to all of your devices that have the Google Cloud console Mobile App installed.

Cloud Monitoring determines the notification scope when the channel is created. You can't select or change the scope.

To configure a Google Cloud console Mobile App notification channel for a specific Google Cloud project, do the following:

  1. Install the Google Cloud console Mobile App from your mobile device's app store.
  2. Select a project for viewing in the Google Cloud console Mobile App.

    After you select a project, a data exchange between the app and the selected Google Cloud project occurs. A notification channel is created when one doesn't exist, and after a few minutes, this channel is listed under the Mobile Devices section of the Notification channels page.

To add your mobile device as a notification channel for an alerting policy, in the alerting Notifications section, select Google Cloud console (mobile) and then choose your mobile device from the list.

Slack

To set up Slack notifications, do the following:

  1. In Slack: Create a Slack workspace and channel at the Slack site. Record the channel URL.

  2. In the Google Cloud console, go to the  Alerting page:

    Go to Alerting

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  3. Click Edit notification channels.

  4. In the Slack section, click Add new to open the Slack sign-in page:

    1. Select your Slack workspace.
    2. Click Allow to enable Cloud Monitoring access to your Slack workspace. This action takes you back to the Monitoring configuration page for your notification channel.
    3. In the Slack Channel Name field, enter the name of the Slack channel you want to use for notifications.
    4. In the Cloud Alerting Display Name field, enter a short descriptive statement. Monitoring displays the value of this field on the Notifications channel page.
    5. (Optional) To test the connection between Cloud Monitoring and your Slack workspace, click Send test notification. If the connection is successful, then you see a message This is a test alert notification... in the Slack notification channel that you specified. Check the notification channel to confirm receipt.
  5. If the Slack channel you want to use for notifications is a private channel, then you must manually invite the Monitoring app to the channel:

    1. Open Slack.
    2. Go to the channel you specified as your Monitoring notification channel.

    3. Invite the Monitoring app to the channel by entering and sending the following message in the channel:

      /invite @Google Cloud Monitoring

      Be sure you invite the Monitoring app to the private channel you specified when creating the notification channel in Monitoring. Inviting the Monitoring app to public channels is optional.

Webhooks

To configure Webhooks notifications, do the following:

  1. The webhook handler: Identify the public endpoint URL to receive webhook data from Monitoring.
  2. In the Google Cloud console, go to the  Alerting page:

    Go to Alerting

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  3. Click Edit notification channels.
  4. In the Webhook section, click Add new.
  5. Complete the dialog.
  6. Click Test Connection to send a test payload to the Webhook endpoint. You can go to the receiving endpoint to verify delivery.
  7. Click Save.

Webhook schema

To view the Webhook schema structure for Error Reporting, click the following:

Basic authentication

In addition to the webhook request sent by Cloud Monitoring, basic authentication utilizes the HTTP specification for the username and password. Cloud Monitoring requires your server to return a 401 response with the proper WWW-Authenticate header. For more information about basic authentication, see the following:

Token authentication

Token Authentication requires a query string parameter in the endpoint URL and a key that the server expects to be secret between itself and Monitoring. The following is a sample URL that includes a token:

https://www.myserver.com/stackdriver-hook?auth_token=1234-abcd

If Monitoring posts an incident to the endpoint URL, your server can validate the attached token. This method of authentication is most effective when used with SSL/TLS to encrypt the HTTP request preventing snoopers from learning the token.

For an example server in Python, see this sample server.

Edit and delete notification channels

To edit or delete a notification channel by using the Google Cloud console, do the following:

  1. In the Google Cloud console, go to the  Alerting page:

    Go to Alerting

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  2. Click Edit notification channels.

    The Notification channels dashboard contains a section for each type of notification channel. Each section lists all configurations for that type:

    • To modify an entry, click Edit. Click Save after your changes are complete.
    • To delete an entry, click Delete. Click Delete in the confirmation dialog.

Select notification channels through the Google Cloud console

To select an existing notification channel, you must have one of the following roles:

  • Error Reporting User
  • Error Reporting Admin
  • Project Editor
  • Project Owner

To select where you want to send notifications when new error groups occur, complete the following steps.

  1. In the Google Cloud console, go to the Error Reporting page:

    Go to Error Reporting

    You can also find this page by using the search bar.

  2. Click Configure notifications to open the Error notifications page.

  3. In the Notification channels drop-down menu, select the channels that you want to send the notifications to.

    If you don't see the channel you need, click Manage notification channels to create a new channel. To create a notification channel, your role must be one those listed in Creating channels.

  4. After selecting the channels, click Save.

Additional information

Following is additional information that applies when creating and managing notifications in Error Reporting.

Notification contents

Notifications for error groups contain information related to the log entries in the group. The included information depends on the type of monitored resource in which the error occurred. For example, some notifications might contain the name and version of the monitored resource.

The error message is included in the notification only when the error group is identified by the log entries in a log bucket whose region is global.

When are notifications sent

Error Reporting sends a notification in two scenarios:

  • When the error group hasn't ever been seen by Error Reporting.
  • When an error occurs for an existing error group and the error group status is set to Resolved.

To receive future notifications for the error group, you must set the error group status to Resolved. No other actions, like using the API to delete the error group or waiting for the data to age out, result in a notification if another error occurs.

Notification rate limit

Error Reporting uses the following rules to limit the number of notifications you might receive due to errors:

  • At most 5 notifications due to an error can be sent in a 60-minute window.

  • If more than 5 errors occur in a 60-minute window, then the following occurs:

    • You receive a notification that further notifications are silenced for the next six hours.

    • A log entry with the severity level of the warning is written.

  • When you resolve an error group, notifications for that error group are suspended for five minutes.

Resolution status

If an error with a resolution status of Resolved reoccurs, even if it has been previously deleted, its resolution status changes back to Open and Error Reporting sends a notification.

Error Reporting won't send a notification if a Muted error reoccurs.

To manage the resolution status of your errors, go to Manage errors.

Mobile notifications

Error Reporting sends mobile notifications to the Google Cloud app on Android and iOS. To opt into mobile notifications, you must first install the app on your mobile device:

Download the Google Cloud app

Google Cloud console mobile app illustration. Google Cloud console mobile app details.