Create, query, and manage analytics views

Preview

This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

This document describes how to create and manage analytics views. Afteryou create an analytics view, you can query it in a manner similar to queryinglog views and observability views.

For an overview of analytics views, then seeAbout analytics views.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.
    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Observability API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.
    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Observability API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

    Enable the API

  8. To get the permissions that you need to create, manage, and use analytics views, ask your administrator to grant you the following IAM roles:

    • Observability View Accessor (roles/observability.viewAccessor) on the observability views that you want to query. This role supports IAM conditions, which let you restrict the grant to a specific view. If you don't attach a condition to the role grant, then the principal can access all observability views. Observability views are in Public Preview.
    • Observability Analytics User (roles/observability.analyticsUser) on your project. This role contains the permissions required to save and run private queries, and to run shared queries.
    • Logs Viewer (roles/logging.viewer) on your project.
    • Logs View Accessor (roles/logging.viewAccessor) on the project that stores the log views that you want to query. You can restrict this role grant to a specific view by adding an IAM condition.

    For more information about granting roles, seeManage access to projects, folders, and organizations.

    You might also be able to get the required permissions throughcustom roles or otherpredefined roles.

  9. Make sure that you have at least one of the following:

Create an analytics view

Note: An analytics view can query log views and observability views. When an analytics viewqueries multiple views, then those views must be in the same location.For example, if you have twolog buckets in theus-east1 location, then you can create a analytics viewthat queries log views on those two log buckets.

To create an analytics view, do the following:

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

    Go toLog Analytics

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

  2. Configure theLog Analytics page:
    1. Make sure that the toolbar displaysRun query. If the toolbar displaysRun in BigQuery, then clickSettings and selectLog Analytics (default).
    2. If theViews menu isn't shown, then go to the navigation pane and clickViews and Schema.

  3. Enter and validate the query that you want to save as an analytics view.

    You might want to load and edit the default query for thelog view or observability view that your analytics view will query.To load the default query, do the following:

    1. In theViews menu, and then do oneof the following:

      • Go to theLogs section and select a log view.
      • Go to theTraces section and select_Trace.Spans._AllSpans.
    2. In theSchema toolbar, clickQuery, and thenclickOverwrite.

      TheQuery pane is updated with a SQL query.

    3. Update the query until you're satisfied with the query results.

  4. Create an analytics view:

    1. In the toolbar, clickSave, and then selectSave as analytics view.

    2. Enter a name and description for the analytics view.

      The name is limited to 100 characters and can include only letters,digits, underscores, and hyphens.. You can't change the name after youcreate the analytics view.

    3. ClickSave.

    The system creates your analytics view and lists it in theViews pane,in theAnalytics Views section.

Query an analytics view

You query an analytics view in a manner analogous to queryinglog views and observability views. To query analytics views ,use the following format for theFROM clause:

FROM`analytics_view.PROJECT_ID.LOCATION.ANALYTICS_VIEW_ID`

The fields in the previous expressions have the following meaning:

  • PROJECT_ID: The identifier of the project.
  • LOCATION: The location of the analytics view.
  • ANALYTICS_VIEW_ID: The ID of the analytics view, which is limited to 100 characters and can include only letters,digits, underscores, and hyphens.

To learn more, seeLog Analytics.

List analytics views

To list the analytics views in your Google Cloud project, do the following:

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

    Go toLog Analytics

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

  2. Configure theLog Analytics page:
    1. Make sure that the toolbar displaysRun query. If the toolbar displaysRun in BigQuery, then clickSettings and selectLog Analytics (default).
    2. If theViews menu isn't shown, then go to the navigation pane and clickViews and Schema.

  3. In theViews menu, go to theAnalytics Views section.

Get details about an analytics views

You can use options in theSchema pane to display the following informationabout an analytics view:

  • Name.
  • Create date.
  • Last update.
  • Schema.
  • Query.

To view the details for an analytics views, list the analytics viewsin your project, and then do the following:

  1. Select the analytics view whose information you want to view.
  2. In theSchema toolbarclickView analytics view options,and selectView details.

Modify an analytics view

To modify an analytics view, do the following:

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

    Go toLog Analytics

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

  2. Configure theLog Analytics page:
    1. Make sure that the toolbar displaysRun query. If the toolbar displaysRun in BigQuery, then clickSettings and selectLog Analytics (default).
    2. If theViews menu isn't shown, then go to the navigation pane and clickViews and Schema.

  3. In theViews menu, go to theAnalytics Views section, and selectthe analytics view that you want to modify.
  4. In theSchema toolbar,clickView analytics view options,and selectEdit view.

    A dialog opens that displays information about the analytics view.You can modify the description and query.

  5. After you complete your modifications, clickOverwrite saved view.

Delete an analytics view

Note: If you've written queries against an analytics view and deletethe analytics view, then those queries will fail.

To delete an analytics view, do the following:

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

    Go toLog Analytics

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

  2. Configure theLog Analytics page:
    1. Make sure that the toolbar displaysRun query. If the toolbar displaysRun in BigQuery, then clickSettings and selectLog Analytics (default).
    2. If theViews menu isn't shown, then go to the navigation pane and clickViews and Schema.

  3. In theViews menu, go to theAnalytics Views section, and selectthe analytics view that you want to delete.
  4. In theSchema toolbar,clickView analytics view options,selectDelete view, and complete the dialog.

Limitations

The following limitations apply to analytics views:

  • An analytics view can only query log views and observability views.
  • The parent resource of an analytics view must be a Google Cloud project.
  • You can only query an analytics view by using theLog Analytics page,and only when you use theLog Analytics (default) query engine.
  • All views that an analytics view queries must be in the same location.
  • You must use the Google Cloud console to create or manage youranalytics views.
  • You can create at most 100analytics views per Google Cloud project.
  • You can create a most 50analytics views per region.
  • Per Google Cloud project, at most 10regions can contain an analytics view.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.