設定 Cloud Logging
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
啟用 Cloud Logging
Fleet Engine 應會自動啟用記錄功能。
- 開啟 Logs Explorer。
輸入下列查詢:
resource.type:"fleetengine.googleapis.com"
如果查詢清單記錄的結果,表示記錄功能已啟用。
如果這項查詢的結果中未列出任何記錄,可能是因為專案未啟用 Cloud Logging。如要啟用 Cloud Logging,請與 Google 地圖平台支援團隊聯絡。
啟用受限用途記錄
根據行動服務專屬條款,Fleet Engine 產生的部分記錄資料可能只會保留 30 天。Fleet Engine 會將這些記錄標示為 TOS_RESTRICTED
,並分類到受限保留記錄 bucket 中,您必須建立該 bucket,如下所示。
所有其他記錄資料都會指派至預設 bucket,並可保留較長時間,詳情請參閱行動服務專屬條款。如要自訂記錄檔值區和保留期限,請參閱 Google Cloud 控制台中的「記錄檔儲存空間」。
如要進行分析,您可以合併受限和預設記錄中的資料,取得完整的記錄資料集。
如要啟用受限制用途記錄,請按照下列步驟操作:
為受限用途記錄檔建立接收器和 bucket,並將記錄檔篩選至適當的 bucket。
如要啟用受限用途記錄,請與支援團隊聯絡。
詳情請參閱以下各節說明。
在專案中建立接收器和 bucket,用於存放受限記錄
在「Logs Explorer」(記錄檔探索工具) 的左側導覽中,開啟「Log Router」(記錄檔路由器) 頁面。
修改「_Default logging bucket」,排除受限用途的記錄。
- 在「記錄檔路由器接收器」下方,選取「預設記錄檔 bucket」。
- 從「動作」選單中選擇「編輯接收器」。
- 前往「選擇要從接收器中篩除的記錄」部分,然後按一下「新增排除項目」按鈕。
- 將「排除」篩選器名稱設為「ExcludeRestrictedLogs」ExcludeRestrictedLogs。
- 在「建立排除篩選器」方塊中,貼上這個篩選器:
labels.restriction="TOS_RESTRICTED"
- 按一下「更新接收器」。
建立受限記錄 bucket,用來儲存受限用途記錄。方法是為所有記錄檔建立接收器和 bucket,然後排除非受限記錄檔。
- 在「記錄路由器」頁面頂端附近,選取「建立接收器」。
- 填寫「接收器詳細資料」:
- 名稱:RestrictedLogs
- 說明:將 Fleet Engine 限制用途記錄傳送至 Cloud Logging。
- 點選 [下一步]。
- 填入「Sink destination」(接收器目標位置):
- 選取接收器服務:記錄檔值區
- 選取記錄檔值區:選取「建立新的記錄檔值區」。
- 在「Bucket details」(Bucket 詳細資料) 對話方塊中,填入下列資訊:
- 名稱:Restricted
- 說明:包含 Fleet Engine 限制用途記錄。
- 其餘設定維持不變,然後點選「下一步」。
- 將「保留期限」設為 30 天。(保留期限不得超過 30 天)。
- 點選「建立值區」。
- 返回接收器建立對話方塊,將「Logs to include in sink」(要納入接收器的記錄) 區段留空。
- 在「要從接收器中篩除的記錄」部分中,按一下「新增排除條件」,然後填寫下列欄位:
- 排除篩選器名稱:ExcludeNonRestrictedLogs
- 排除篩選器:
NOT (resource.type =
"fleetengine.googleapis.com/Fleet" OR resource.type =
"fleetengine.googleapis.com/DeliveryFleet") NOT (labels.restriction
= "TOS_RESTRICTED")
- 按一下「建立接收器」。
- 前往 Google 地圖平台支援
- 按一下「建立案件」,開始建立新的支援要求。
用下列資訊作答:
- 要啟用的專案 ID。
- 要求變更者的電子郵件地址。這個人應具備您列出 Google Cloud 專案的編輯權限。
請輸入「是」,表示同意下列事項:在 Cloud Logging 中啟用受限用途的 Google 地圖內容,即表示您同意遵守《Google 地圖平台條款》和《行動服務專屬條款》,包括與 Google 地圖內容相關的快取和允許用途規定。
支援團隊處理完您的要求後,您會收到確認電子郵件,得知專案已啟用記錄功能。
後續步驟
瞭解如何在記錄檔探索工具中處理記錄。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eFleet Engine automatically enables logging, verifiable via a query in the Logs Explorer using \u003ccode\u003eresource.type:"fleetengine.googleapis.com"\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eRestricted-use logs, labeled \u003ccode\u003eTOS_RESTRICTED\u003c/code\u003e, require a dedicated bucket with a 30-day retention period due to the Mobility Service Specific Terms.\u003c/p\u003e\n"],["\u003cp\u003eEnabling restricted-use logs involves creating a separate sink and bucket, then contacting Google Maps Platform Support for activation.\u003c/p\u003e\n"],["\u003cp\u003eFleet Engine logs may contain sensitive information and require careful access management using Google Cloud's Identity and Access Management for Cloud Logging.\u003c/p\u003e\n"]]],[],null,["Enable Cloud Logging\n\nFleet Engine should automatically have logging enabled.\n\n1. Open the [Logs Explorer](https://cloud.google.com/logging/docs/view/logs-explorer-interface).\n2. Enter the following query:\n\n resource.type:\"fleetengine.googleapis.com\"\n\nIf the results for the query list logs, then logging is enabled.\n\nIf you don't see any logs listed in the results for this query,\nCloud Logging may not be enabled for your project. To enable\nCloud Logging, contact [Google Maps Platform Support](https://console.cloud.google.com/google/maps-apis/support).\n\nEnable restricted use logs\n\nIn accordance with the [Mobility Service Specific Terms](/maps/documentation/transportation-logistics-terms/mobility/service-terms), some\nof the log data that Fleet Engine generates may only be retained for 30 days.\nFleet Engine labels those logs as `TOS_RESTRICTED` and sorts them into a\nrestricted-retention log bucket, which you must create as shown below.\n\nAll other log data is assigned to the default bucket where it can be retained\nlonger, as defined in the [Mobility Service Specific Terms](/maps/documentation/transportation-logistics-terms/mobility/service-terms).\nSee [Logs Storage](/maps/documentation/mobility/operations/cloud-logging/console.cloud.google.come/logs/storage) in the Google Cloud\nConsole about customizing your log buckets and their retention periods.\n\nFor analysis, you can join the data from restricted and default logs for a\ncomplete set of log data.\n\nDo the following to enable restricted use logs:\n\n1. Create a sink and bucket for restricted-use logs, and filter logs into their\n appropriate buckets.\n\n2. Contact support to enable restricted-use logs.\n\nFor details, see the following sections.\n\nCreate a sink and bucket for restricted logs in your project\n\n1. In the [Logs Explorer](https://cloud.google.com/logging/docs/view/logs-explorer-interface), in the left-hand\n navigation, open the **Log Router** page.\n\n2. Modify the _Default logging bucket to exclude restricted-use logs.\n\n 1. Under **Log Router Sinks**, select the _Default logging bucket.\n 2. Choose **Edit sink** from the **Actions** menu.\n 3. Go to the **Choose logs to filter out of sink** section and click the **Add Exclusion** button.\n 4. Set the **Exclusion filter name** to *ExcludeRestrictedLogs*.\n 5. In the **Build and exclusion filter** box, paste this filter: `labels.restriction=\"TOS_RESTRICTED\"`\n 6. Click **Update sink**.\n3. Create a restricted logging bucket to store the restricted-use logs. You do\n this by creating a sink and bucket for all logs, and then excluding the\n non-restricted logs.\n\n 1. On the [Log Router page](https://console.cloud.google.com/logs/router), towards the top, select **Create sink**.\n 2. Fill in the **Sink details** :\n 1. Name: *RestrictedLogs*\n 2. Description: *Routes Fleet Engine restricted-use logs.*\n 3. Click **Next**.\n 4. Fill in the **Sink destination** :\n 1. Select Sink service: Logging bucket\n 2. Select log bucket: Select **Create new log bucket**.\n 3. In the **Bucket details** dialog, fill in:\n 1. Name: *Restricted*\n 2. Description: *Contains Fleet Engine restricted-use logs.*\n 4. Leave the rest as is and click **Next**.\n 5. Set the **Retention period** to 30 days. (The retention period must not exceed 30 days.)\n 6. Click **Create bucket**.\n 5. Back in the sink creation dialog, leave the **Logs to include in sink** section empty.\n 6. In the **Logs to filter out of sink** section, click **Add Exclusion** and fill in:\n 1. Exclusion filter name: *ExcludeNonRestrictedLogs*\n 2. Exclusion filter: `NOT (resource.type =\n \"fleetengine.googleapis.com/Fleet\" OR resource.type =\n \"fleetengine.googleapis.com/DeliveryFleet\") NOT (labels.restriction\n = \"TOS_RESTRICTED\")`\n 7. Click **Create sink.**\n\nContact support to enable restricted-use logs\n\n1. Go to [Google Maps Platform Support](https://console.cloud.google.com/google/maps-apis/support)\n2. Click **Create Case** to start a new support request.\n3. Provide the following information:\n\n - Project ID(s) to enable.\n - Email address of the person requesting the change. This person should have edit access to the Google Cloud Projects you are listing.\n4. Agree to the following by writing **Yes** : *By enabling restricted-use\n Google Maps Content in Cloud Logging, you agree to adhere to the\n [Google Maps Platform terms](https://cloud.google.com/maps-platform/terms/) and [Mobility service specific\n terms](/maps/documentation/transportation-logistics-terms/mobility/service-terms), including caching and permitted use requirements as they relate\n to Google Maps Content.*\n\nOnce the support team handles your request, you will receive a confirmation that\nlogging has been enabled for your project.\n| **Note:** Fleet Engine logs may contain sensitive vehicle and trip information. You can restrict and audit access to these logs with Google Cloud [Identity and Access Management for Cloud Logging](https://cloud.google.com/logging/docs/access-control).\n\nWhat's next\n\nLearn how to [Work with logs in Logs Explorer](/maps/documentation/mobility/operations/cloud-logging/work-with-logs)."]]