设置 Cloud Logging
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
启用 Cloud Logging
Fleet Engine 应会自动启用日志记录功能。
- 打开日志浏览器。
输入以下查询:
resource.type:"fleetengine.googleapis.com"
如果查询结果列出了日志,则表示已启用日志记录。
如果您在此查询的结果中未看到任何列出的日志,则可能是因为您的项目未启用 Cloud Logging。如需启用 Cloud Logging,请与 Google Maps Platform 支持团队联系。
启用受限用途日志
根据移动服务专用条款,Fleet Engine 生成的部分日志数据可能仅保留 30 天。Fleet Engine 会将这些日志标记为 TOS_RESTRICTED
,并将其归入受限保留期日志存储分区中,您必须按如下所示创建该存储分区。
所有其他日志数据都会分配到默认存储分区,在该存储分区中,这些数据可以保留更长时间,具体如移动服务专用条款中所述。
如需了解如何自定义日志存储分区及其保留期限,请参阅 Google Cloud 控制台中的日志存储。
如需进行分析,您可以将受限日志和默认日志中的数据联接起来,以获得完整的日志数据集。
如需启用受限使用日志,请执行以下操作:
为受限用途的日志创建接收器和存储分区,并将日志过滤到相应的存储分区中。
请与支持团队联系以启用受限用途日志。
如需了解详情,请参阅以下各部分。
在项目中为受限日志创建接收器和存储分区
在 Logs Explorer 中,打开左侧导航栏中的日志路由器页面。
修改 _Default 日志记录存储分区,以排除受限用途的日志。
- 在日志路由器接收器下,选择 _Default 日志存储分区。
- 从操作菜单中选择修改接收器。
- 前往选择要从接收器中过滤掉的日志部分,然后点击添加排除项按钮。
- 将排除过滤器名称设置为 ExcludeRestrictedLogs。
- 在构建排除项过滤条件框中,粘贴以下过滤条件:
labels.restriction="TOS_RESTRICTED"
- 点击更新接收器。
创建一个受限的日志存储分区,用于存储受限用途的日志。为此,您可以为所有日志创建一个接收器和存储分区,然后排除非受限日志。
- 在日志路由器页面顶部附近,选择创建接收器。
- 填写接收器详情:
- 名称:RestrictedLogs
- 说明:路由 Fleet Engine 受限使用日志。
- 点击下一步。
- 填写接收器目标位置:
- 选择接收器服务:Logging 存储分区
- 选择日志存储分区:选择创建新的日志存储分区。
- 在存储分区详情对话框中,填写以下信息:
- 名称:受限
- 说明:包含 Fleet Engine 受限使用日志。
- 其余设置保持不变,然后点击下一步。
- 将保留期限设置为 30 天。(保留期限不得超过 30 天。)
- 点击创建存储分区。
- 返回到接收器创建对话框,将要纳入接收器的日志部分留空。
- 在要从接收器中过滤掉的日志部分,点击添加排除项,然后填写以下内容:
- 排除项过滤条件名称:ExcludeNonRestrictedLogs
- 排除项过滤条件:
NOT (resource.type =
"fleetengine.googleapis.com/Fleet" OR resource.type =
"fleetengine.googleapis.com/DeliveryFleet") NOT (labels.restriction
= "TOS_RESTRICTED")
- 点击创建接收器。
- 前往 Google Maps Platform 支持页面
- 点击创建支持请求以开始创建新的支持请求。
提供以下信息:
- 要启用的项目 ID。
- 请求更改的用户的电子邮件地址。此人应具有对您列出的 Google Cloud 项目的编辑权限。
请写下是,以表示您同意以下内容:在 Cloud Logging 中启用受限用途的 Google 地图内容即表示您同意遵守 Google Maps Platform 条款和移动服务专用条款,包括与 Google 地图内容相关的缓存和许可使用要求。
支持团队处理您的请求后,您会收到一封确认电子邮件,告知您已为您的项目启用日志记录。
后续步骤
了解如何在日志浏览器中使用日志。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):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)."]]