[[["易于理解","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-12。"],[],[],null,["# Viewing logs and metrics\n\nThis page describes logs and metrics for Network Connectivity Center, NCC Gateway\nspokes, and metrics for Router appliance.\n\nLogging for Router appliance is handled by Cloud Router;\nfor more information, see\n[View logs and metrics](/network-connectivity/docs/router/how-to/viewing-logs-metrics).\n\nHow metrics work\n----------------\n\nThe `local_resource_type` label reports the number of data\ntransfer bytes on the Google Cloud side of the resource monitored.\nThat is, the label reports when the resource attached to a spoke sends\ntraffic to another Google Cloud resource.\n\nThe `local_resource_type` label can take one of the following values:\n\n- A Compute Engine virtual machine (VM) value called `GCE_VM`\n- An HA VPN gateway value called `VPN`\n- An Cloud Interconnect VLAN attachment called `ICA`\n- A value for traffic to all other resources called `OTHER`\n- A value for the router appliance instance called `ROUTER_APPLIANCE`\n\nIf the `local_resource_type` is `VPN`, `ICA`, or `ROUTER_APPLIANCE`, the\nmetric reports data transfer information. For more information about data\ntransfer, see [Network Connectivity Center overview](/network-connectivity/docs/network-connectivity-center/concepts/overview#data-transfer).\n\nLogs\n----\n\nNetwork Connectivity Center hubs send logs to [Logging](/logging/docs).\nBecause hybrid spokes always use Cloud Routers, review\n[the Cloud Router logs and metrics\ndocumentation](/network-connectivity/docs/router/how-to/viewing-logs-metrics).\n\n### How to view logs\n\nTo view logs for Network Connectivity Center, follow these steps. \n\n### Console\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs)\n2. To see all Network Connectivity Center logs, on the first pull-down menu,\n select the metric for the spoke resource attached to the spoke.\n For example, HA VPN.\n\n To see logs for just one hub, on the menu, select a single hub name.\n\n Log fields of type *boolean* typically only appear if they have a value of\n `true`. If a boolean field has a value of `false`, that field is omitted\n from the log.\n\n [UTF-8](https://wikipedia.org/wiki/UTF-8)\n encoding is enforced for log fields. Characters that are not UTF-8\n characters are replaced with question marks.\n\n### Routing logs\n\nYou can configure the sinks of\n[logs-based metrics](/logging/docs/logs-based-metrics) for\nNetwork Connectivity Center resource logs.\n\nLogging stores Network Connectivity Center logs for only 30 days.\nIf you want to keep your logs for a longer period, you must\n[route them](/logging/docs/routing/overview).\n\nYou can route Network Connectivity Center logs\nto [Pub/Sub](/pubsub) or [BigQuery](/bigquery) for\nanalysis.\n\n### What is logged\n\nNetwork Connectivity Center log entries contain the following types of information that\nis useful for monitoring and debugging your hubs:\n\n- General information shown in most Google Cloud logs, such as severity, project ID, project number, and timestamp.\n- Other information that varies depending on the log entry.\n\nMonitoring metrics\n------------------\n\nTo view metrics and create alerts related to your Network Connectivity Center and\nNCC Gateway spokes, use\n[Cloud Monitoring](/monitoring/docs).\n\nIn addition to the predefined dashboards in Monitoring, you can\ncreate custom dashboards, set up alerts, and query the metrics through the\n[Monitoring API](/monitoring/api).\n\n### Monitoring metrics for Network Connectivity Center\n\nThe following metrics for the `connectivity_hub` resource type are\n[reported into Monitoring](/monitoring/api/metrics).\n\nAll of the metrics in the following table measure *user payload*. They\nmeasure the bytes that were sent by the user, rather than the encapsulated\ntraffic, which includes transport and network protocol headers. Also,\ndepending on the type of transport, traffic might be compressed as part\nof transport.\n\n### Monitoring metrics for NCC Gateway\n\nYou can access the following metrics for NCC Gateway spokes in\nCloud Monitoring:\n\n- Packet count that is sent and received from the NCC Gateway.\n- Byte count that is sent and received from the NCC Gateway.\n- Relevant packet processing events and health of the NCC Gateway routing plane.\n\n### View metrics in Metrics Explorer\n\n\u003cbr /\u003e\n\nTo view Monitoring metrics in\nMetrics Explorer, follow these steps. \n\n### Console\n\nTo view the metrics for a monitored resource by using the\nMetrics Explorer, do the following:\n\n1. In the Google Cloud console, go to the\n *leaderboard* **Metrics explorer** page:\n\n [Go to **Metrics explorer**](https://console.cloud.google.com/monitoring/metrics-explorer)\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 **Metric** element, expand the **Select a metric** menu, enter `networking` in the filter bar, and then use the submenus to select a specific resource type and metric:\n 1. In the **Active resources** menu, select a resource.\n 2. To select a metric, use the **Active metric categories** and **Active metrics** menus. For a list of metrics, see [Network Connectivity Center metrics list](#ncc-monitoring-metrics).\n 3. Click **Apply**.\n4. To remove time series from the display, use the\n [**Filter** element](/monitoring/charts/metrics-selector#filter-option).\n\n5. To combine time series, use the menus on the\n [**Aggregation** element](/monitoring/charts/metrics-selector#select_display).\n For example, to display the CPU utilization for your VMs, based on their zone, set the\n first menu to **Mean** and the second menu to **zone**.\n\n All time series are displayed when the first menu of the **Aggregation** element is set\n to **Unaggregated** . The default settings for the **Aggregation** element\n are determined by the metric type you selected.\n6. For quota and other metrics that report one sample per day, do the following:\n 1. In the **Display** pane, set the **Widget type** to **Stacked bar chart**.\n 2. Set the time period to at least one week.\n\n### Define custom dashboards\n\nTo create custom Monitoring dashboards over Network Connectivity Center\nmetrics, follow these steps: \n\n### Console\n\n1. In the Google Cloud console, go to the **Monitoring** page.\n\n [Go to Monitoring](https://console.cloud.google.com/monitoring)\n2. Select **Dashboards** , and then select **Create Dashboard**.\n\n3. Click **Add Chart**.\n\n4. Give the chart a title.\n\n5. Select metrics and filters. For metrics, the resource type is\n **Connectivity Hub**.\n\n6. Click **Save**.\n\nWhat's next\n-----------\n\n- To learn more about Network Connectivity Center, see the [Network Connectivity Center overview](/network-connectivity/docs/network-connectivity-center/concepts/overview).\n- To learn more about Router appliance, see the [Router appliance overview](/network-connectivity/docs/network-connectivity-center/concepts/ra-overview).\n- To find solutions for Network Connectivity Center and Router appliance issues, see [Troubleshoot Network Connectivity Center](/network-connectivity/docs/network-connectivity-center/support/troubleshooting)."]]