Show events on a dashboard

This document describes how you can display events on the charts on a dashboard. An event is an activity, such as a deployment or a crash, that affects the operation of a system. Showing events can help you correlate data from different sources when you're troubleshooting an issue.

Events are identified by querying the logs generated in your Google Cloud project, or directly routed to your Google Cloud project, for specific event types. Logs from other Google Cloud projects, even if they are stored in a log bucket in the current Google Cloud project, aren't queried. You can use the provided queries in the Logs Explorer and in log-based alerting policies. For a list of events and the corresponding queries, see the Event types page.

If you configure a dashboard to display events, then as those events occur, the charts on your dashboards are annotated. Dashboard filters, which limit the data displayed by a dashboard, typically filter both time-series data and events.

The following screenshot illustrates a chart that is displaying one annotation, with the tooltip for the annotation activated:

Chart displaying warning and informational event annotations.

Each annotation can list multiple events. In the previous screenshot, an event for a GKE deployment is listed.

Before you begin

To get the permissions that you need to view charts and logs, and to create alerting policies, ask your administrator to grant you the following IAM roles on your project:

  • View charts, and to view and create alerting policies: Monitoring Editor (roles/monitoring.editor).
  • View all logs except data access logs that are created in your Google Cloud project: Logs Viewer (roles/logging.viewer).
  • View data access logs that are created in your Google Cloud project: Private Logs Viewer (roles/logging.privateLogViewer).

For more information about granting roles, see Manage access.

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

Show events

For a list of event types, troubleshooting references, and queries that can be use with the Logs Explorer or with log-based alerting policies, see the Event types page.

Console

To show events, do the following:

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Dashboards:

    Go to Dashboards

  2. Select the dashboard that you want to view.
  3. In the dashboard's toolbar, ensure the Events toggle is on.

    If the Events toggle isn't displayed, then the dashboard doesn't support the display of events.

  4. For each event type that you want to display, in the dashboard toolbar, click Add event, and then select the event type from the menu.

    For example, you might configure your dashboard to display "GKE Workload Deployment" events.

    After you add an event type, Cloud Monitoring queries your log data, which takes a few moments, and then adds the annotations to the charts on the dashboard:

    • Info: An informational message.
    • Warning: Indicates a failure, such as a reboot or a crash.
    • Alert: Indicates that an incident was opened.
  5. To view a summary of an event or to access links to logs, use your pointer to activate the tooltip.

View logs for an event

When you are viewing a chart that is displaying event annotations, you can access the logs associated with the events:

  • To view logs for a specific event, use your pointer to activate the tooltip for an annotation that lists the event, go to the event, and then click View logs.

  • To view the logs for all events identified by the annotation, use your pointer to activate the tooltip for the annotation, go to the summary line of the tooltip, and then click View logs.

In another browser tab, the Logs Explorer opens with the query parameters set to query for the specific event, or for the collection of events.

Create alerting policies

To get notified when an event appears in your logs, configure a log-based alert. Log-based alerting policies query your logs as they are received. When the query returns a non-empty result, an incident is created and notifications are sent.

Console

To create a logs-based alert, do the following:

  1. If you haven't configured a notification channel, then do the following:

    1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Alerting:

      Go to Alerting

    2. Click Edit notification channel.
    3. Go to the type of notification channel that you want to configure, click Add new, and then complete the dialog.
  2. In the navigation panel of the Google Cloud console, select Logging, and then select Logs Explorer:

    Go to Logs Explorer

  3. In the toolbar, select Create Alert.

  4. Enter a name for the alerting policy and then click Next.

  5. In the Define log entries to alert on section, enter a query or update the query that was copied from the Query pane when you selected Create Alert.

    For each event type, the Event types page lists a query that is suitable for use in a log-based alert.

  6. Complete the dialog, and then click Save.

Hide events

Console

To hide all events, in the dashboard toolbar, ensure the Events toggle is off.

To hide one type of event, set the toggle for that event type to the off position.

What's next