[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# View logs routed to Cloud Logging buckets\n\nThis document explains how you can find log entries that you routed to\n[Cloud Logging buckets](/logging/docs/store-log-entries).\nLog buckets are Cloud Logging storage containers in your Google Cloud projects\nthat hold your logs data. You can create log sinks to route all, or\njust a subset, of your logs to any bucket in Cloud Logging. This flexibility\nlets you choose which Google Cloud project your logs are stored in and\nwhat other logs are stored with them.\n\nLogs that you route to Cloud Logging buckets are available immediately.\n\nFor information about viewing logs routed to other destinations, see\nthe following documents:\n\n- [Cloud Storage](/logging/docs/export/storage)\n\n\u003c!-- --\u003e\n\n- [BigQuery](/logging/docs/export/bigquery)\n\n\u003c!-- --\u003e\n\n- [Pub/Sub](/logging/docs/export/pubsub)\n\nBefore you begin\n----------------\n\nFor instructions about how to create and manage log buckets,\nsee the following documents:\n\n- [Create a log bucket](/logging/docs/buckets#create_bucket)\n- [Upgrade a bucket to use Log Analytics](/logging/docs/buckets#upgrade-bucket)\n\nFor a conceptual discussion of sinks, see\n[Overview of routing and storage models: Sinks](/logging/docs/routing/overview#sinks).\n\nFor instructions about how to route your logs, see\n[Route logs to supported destinations](/logging/docs/export/configure_export_v2).\n\nView logs\n---------\n\nTo troubleshoot and view individual log entries in a log bucket,\ndo the following:\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/query)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Logging**.\n2. In the **Action** toolbar, select **Refine scope**.\n3. On the **Refine scope** dialog, select **Log view**.\n4. Select one or more log views and then click **Apply**.\n\n For information about how to run queries, see\n [Build queries in the Logs Explorer](/logging/docs/view/building-queries).\n\nTo perform analytics on log entries stored in a log bucket that is upgraded\nto use Log Analytics, do the following:\n\n1. In the Google Cloud console, go to the **Log Analytics** page:\n\n [Go to **Log Analytics**](https://console.cloud.google.com/logs/analytics)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Logging**.\n2. In the **Log views** list, find the view, and then select **Query** . The\n **Query** pane is populated with a default query, which includes the\n log view that is queried.\n\n You can also enter a query in the **Query** pane, or edit a displayed query.\n\n To query all logs in a log bucket, select the `_AllLogs` view for the\n log bucket.\n3. In the toolbar, click **Run query**.\n\n The query is executed and the result of the query is shown in the\n **Results** tab.\n\n You can use the toolbar options to format your query, clear the query,\n and open the BigQuery SQL reference documentation.\n\n For information about how to run queries, see\n [Query and view logs in Log Analytics](/logging/docs/analyze/query-and-view).\n\nLog entries organization\n------------------------\n\nLogging log entries are objects of type [`LogEntry`](/logging/docs/reference/v2/rest/v2/LogEntry).\n\nLog entries with the same log type, referred to as `[LOG_ID]` in the\n[`LogEntry`](/logging/docs/reference/v2/rest/v2/LogEntry) reference, usually have the same format. The following\ntable shows sample log entries: \n\n### syslog\n\nThe following is an example of a Compute Engine `syslog`: \n\n {\n insertId: \"4zymupf98ac6v\"\n jsonPayload: {\n message: \"Jul 15 13:36:33 my-instance dhclient[328]: DHCPACK of 10.240.0.48 from 169.254.169.254\"\n }\n logName: \"projects/my-gcp-project-id/logs/syslog\"\n receiveTimestamp: \"2024-07-15T13:36:33.400534415Z\"\n resource: {\n labels: {\n instance_id: \"0123456789\" (instance_name: my-instance)\n project_id: \"my-gcp-project-id\"\n zone: \"us-central1-a\"\n }\n type: \"gce_instance\"\n }\n timestamp: \"2024-07-15T13:36:33.097822178Z\"\n }\n\n### request_log\n\nThe App Engine `request_log` has log entries containing\n`protoPayload` fields which hold objects of type\n[`RequestLog`](/logging/docs/reference/v1beta3/rest/v1beta3/RequestLog): \n\n {\n httpRequest: {\n status: 200\n }\n insertId: \"669525c0000d39d1eab2bb03\"\n labels: {1}\n logName: \"projects/my-gcp-project-id/logs/appengine.googleapis.com%2Frequest_log\"\n operation: {4}\n protoPayload: {\n @type: \"type.googleapis.com/google.appengine.logging.v1.RequestLog\"\n appEngineRelease: \"1.9.71\"\n appId: \"s~my-gcp-project-id\"\n startTime: \"2024-07-15T13:36:00.861387Z\"\n ...\n }\n receiveTimestamp: \"2024-07-15T13:36:01.169966997Z\"\n resource: {2}\n spanId: \"7925702051311044593\"\n timestamp: \"2024-07-15T13:36:00.861387Z\"\n trace: \"projects/my-gcp-project-id/traces/8a4fab4bd4fbafac2a0fa901c1485847\"\n resource: {\n labels: {\n module_id: \"default\"\n project_id: \"my-gcp-project-id\"\n version_id: \"20200221t133337\"\n zone: \"us14\"\n }\n type: \"gae_app\"\n }\n }\n\n### activity\n\nThe `activity` log is an Admin Activity [audit log](/logging/docs/audit).\nIts payload is a JSON representation of the\n[`AuditLog`](/logging/docs/audit/api/ref/rest/Shared.Types/AuditLog)\ntype: \n\n {\n insertId: \"dlu8qwc69c\"\n labels: {\n compute.googleapis.com/root_trigger_id: \"a97f30b1-45ab-4c12-9309-8e8af3bb011f\"\n }\n logName: \"projects/my-gcp-project-id/logs/cloudaudit.googleapis.com%2Factivity\"\n operation: {\n id: \"operation-1721047950764-61d48b3bf2b65-1ba1f256-82e9b5fd\"\n last: true\n producer: \"compute.googleapis.com\"\n }\n protoPayload: {\n @type: \"type.googleapis.com/google.cloud.audit.AuditLog\"\n authenticationInfo: {...}\n methodName: \"v1.compute.instances.insert\"\n request: {...}\n requestMetadata: {...}\n resourceName: \"projects/my-gcp-project-id/zones/us-central1-f/instances/my-instance\"\n serviceName: \"compute.googleapis.com\"\n }\n receiveTimestamp: \"2024-07-15T12:52:41.376292847Z\"\n resource: {\n labels: {\n instance_id: \"2891866457752773984\" (instance_name: my-instance)\n project_id: \"my-gcp-project-id\"\n zone: \"us-central1-f\"\n }\n type: \"gce_instance\"\n }\n severity: \"NOTICE\"\n timestamp: \"2024-07-15T12:52:40.965840Z\"\n }\n\nTroubleshooting\n---------------\n\nIf logs seem to be missing from your sink's destination or you otherwise suspect\nthat your sink isn't properly routing logs, then see\n[Troubleshoot routing and sinks](/logging/docs/export/troubleshoot).\n\nPricing\n-------\n\nCloud Logging doesn't charge to route logs to a\nsupported destination; however, the destination might apply charges.\nWith the exception of the `_Required` log bucket,\nCloud Logging charges to stream logs into log buckets and\nfor storage longer than the default retention period of the log bucket.\n\nCloud Logging doesn't charge for copying logs,\nfor creating [log scopes](/logging/docs/log-scope/create-and-manage)\nor [analytics views](/logging/docs/analyze/about-analytics-views),\nor for queries issued through the\n**Logs Explorer** or **Log Analytics** pages.\n\nFor more information, see the following documents:\n\n- The Cloud Logging sections of the [Google Cloud Observability pricing](https://cloud.google.com/stackdriver/pricing) page.\n- Costs when routing log data to other Google Cloud services:\n\n - [Cloud Storage pricing](https://cloud.google.com/storage/pricing)\n - [BigQuery pricing](https://cloud.google.com/bigquery/pricing#data_ingestion_pricing)\n - [Pub/Sub pricing](https://cloud.google.com/pubsub/pricing)\n- [VPC flow log generation charges](https://cloud.google.com/vpc/network-pricing#network-telemetry) apply when you send and then exclude your Virtual Private Cloud flow logs from Cloud Logging."]]