[[["易于理解","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-28。"],[],[],null,["# Add temporary filters to a custom dashboard\n\nThis document describes how you can change what data is displayed on a custom\ndashboard---without having to modify each widget---by adding\n[temporary groupings](#add-grouping) and [temporary filters](#add-temp-filter).\nAfter you add a dashboard-wide grouping or filter, the dashboard toolbar\ndisplays a menu item for that grouping or filter.\n\nWhen troubleshooting, you can modify the data a dashboard displays by adding\ntemporary groupings or filters. For example, if you are investigating an\nincident and want the dashboard to only display data for a specific\nvirtual machine (VM), then add a temporary filter.\n\nTemporary groupings and filters are automatically\ndeleted when you reload the page; however, you can also delete them manually.\n\nYou can also make permanent filters. For example, if you *pin* a filter, then\nit behaves just like a temporary filter except that it is always available.\nYou can also create *variables* , which let you apply a filter to\nselect widgets. For more information, see\n[Create and manage variables and pinned filters](/monitoring/dashboards/filter-permanent).\n\nThis feature is supported only for Google Cloud projects.\nFor [App Hub](/app-hub/docs/overview)\nconfigurations, select the App Hub host project or\nthe app-enabled folder's management project.\n\nHow dashboard filters work\n--------------------------\n\nA dashboard filter specifies a label and a value. The time series that the\ndashboard displays determine the labels available for filtering.\nHow a widget supports a dashboard-wide filter depends on the type of data\nthe widget displays, and the configuration of the widget:\n\n- For widgets that display time-series data, such as a line charts, the\n following rules apply:\n\n - If the time series displayed by the widget doesn't support the label in a\n filter, then the dashboard-wide filter doesn't change the displayed data.\n\n For example, if you add a filter on the label `instance_id`, but a chart\n on the dashboard doesn't display data with an `instance_id` label, then\n the filter doesn't change the displayed data.\n - If the widget specifies a value for a label, then the\n dashboard-wide filter doesn't change the displayed data.\n\n For example, if you add a filter on the label `instance_id`, but a chart\n on the dashboard includes a filter based on the `instance_id` label, then\n the dashboard-wide filter doesn't change the displayed data.\n - Otherwise, the chart filters the data it displays to only those\n time series that satisfy the dashboard-wide filter.\n\n- For logs panel widgets, dashboard-wide filters that are based on a\n resource label update the query. For example, if you add the\n dashboard-wide filter **cluster_name: mycluster** , then the query is\n updated to include **resource.labels.\"cluster_name\"=\"mycluster\"**.\n\nYou can add multiple dashboard-wide filters. These filters are joined with a\nlogical AND.\n\nBefore you begin\n----------------\n\nComplete the following in the Google Cloud project where you want to view\nyour dashboards:\n\n-\n\n To get the permissions that\n you need to add or modify temporary filters by using the Google Cloud console,\n\n ask your administrator to grant you the\n\n\n [Monitoring Viewer](/iam/docs/roles-permissions/monitoring#monitoring.viewer) (`roles/monitoring.viewer`)\n IAM role on your project.\n\n\n For more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\n You might also be able to get\n the required permissions through [custom\n roles](/iam/docs/creating-custom-roles) or other [predefined\n roles](/iam/docs/roles-overview#predefined).\n\n For more information about roles, see\n [Control access with Identity and Access Management](/monitoring/access-control).\n\nCreate or modify temporary groupings\n------------------------------------\n\nWhen you add dashboard-wide groupings, the widgets on the dashboard display\none time series for each set of time series that have the same values for the\ngrouping labels. By default, the average of each set is shown. However, when\nthe widget defines a grouping function, then that function is used.\n\nFor example, assume your dashboard contains a\nchart that displays the CPU utilization of your VM instances. To determine\nwhether you need to deploy more VMs to a particular zone, you could edit the\ndashboard and that chart to change its grouping options. An alternative\nis to temporarily group the dashboard by zone, and then view the\nCPU utilization chart.\n\nTo create or modify the temporary groupings, do the following:\n\n1. In the Google Cloud console, go to the **Dashboards** page:\n\n [Go to **Dashboards**](https://console.cloud.google.com/monitoring/dashboards)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the Google Cloud console, select your Google Cloud project. For [App Hub](/app-hub/docs/overview) configurations, select the App Hub host project or the app-enabled folder's management project.\n3. Expand the *arrow_drop_down* **Group By** menu and then select the labels for grouping.\n4. Click **OK**.\n\nWhen you navigate away from the dashboard,\nany groupings that you created are discarded.\n\nCreate a temporary filter\n-------------------------\n\nWhen you are investigating an incident, you might want to look at data in\nspecific ways. For example, you might want to view only time series\nfor a specific virtual machine or for resources in a specific region. When\nyou create a temporary filter, all dashboard widgets are modified to show\ndata that matches that filter.\nFor example, to configure all charts to show only time series for a specific\nVM instance, create a filter based on the label `instance_id`. Similarly, to\nconfigure the dashboard to only show time series for a specific zone, create a\nfilter based on the label `zone`.\n\nTo create a temporary filter, do the following:\n\n1. In the Google Cloud console, go to the **Dashboards** page:\n\n [Go to **Dashboards**](https://console.cloud.google.com/monitoring/dashboards)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the Google Cloud console, select your Google Cloud project. For [App Hub](/app-hub/docs/overview) configurations, select the App Hub host project or the app-enabled folder's management project.\n3. In the dashboard's *filter_list* filter bar,\n click **Add filter**, and then select a label from the menu.\n\n The menu lists the labels for every time series shown on the dashboard.\n\n After you select a label, a filter is added to the dashboard toolbar.\n The filter's name has the same name as your selection, and its value is set\n to `*`, which matches all values. For example, if you select `zone`, then\n the toolbar displays `zone: *`.\n4. To select a specific value to match,\n click the filter, for example, click `zone: *`, and then select a value\n from the menu. To reduce the number of menu options, enter\n part of the value into the *filter_list* **Filter** area.\n\n| **Note:** For tables that display time-series data, some table cells contain a *filter_list* **Filter dashboard to this value** button, which becomes visible when you place your pointer in the cell. If you select this button, then either a new filter is applied or the value for an existing permanent filter or variable is updated. Existing filters and variables are updated when the label key for the table column matches the label key for a filter or variable.\n\nWhen you navigate away from the dashboard,\nany filters that you created are discarded.\n\nModify a temporary filter\n-------------------------\n\nTo modify the value of a temporary filter, on that filter,\nclick *arrow_drop_down* **Menu**, and then make a selection.\n\nAfter you make a selection, charts and tables are refreshed.\n\nDelete a temporary filter\n-------------------------\n\nTemporary filters are deleted automatically when you navigate away from the\ndashboard. To manually remove a temporary filter, on that filter,\nclick *cancel* **Delete**.\n\nWhat's next\n-----------\n\n- [Explore charted data](/monitoring/charts/working-with-charts)\n- [Access resource-specific dashboards](/monitoring/charts/working-with-legends#resource-dashboards)\n- [Create and manage variables and pinned filters](/monitoring/dashboards/filter-permanent)"]]