降低日志记录费用
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
启用日志记录后,您需要负责设置日志的路由、存储和保留方式。如果您超出免费的使用和保留量限制,则可能会产生额外的 Google Cloud 日志提取和保留费用。请参阅 Google Cloud Observability 价格。
不过,您可以使用下文中介绍的以下任一方法来控制日志记录费用。
减少日志记录用量
您可以通过排除特定日志条目来限制提取的日志数据量。请参阅 Cloud Logging 排除对象和排除日志。
示例:以下命令会更新 _Default
日志存储分区,以排除 GetVehicle
日志。
gcloud logging sinks update _Default \
--add-exclusion=name=get-vehicle,filter='jsonPayload.@type:"type.googleapis.com/maps.fleetengine.v1.GetVehicleLog"'
导出或转送日志
您可以将日志路由到其他 Google Cloud 或外部目的地,以避免产生默认的提取和存储费用。请务必关闭日志提取功能(如下一部分所述),以免产生提取费用。
请参阅 Cloud Logging 导出和导出日志。
关闭日志提取
如果您不打算使用 Fleet Engine 日志,可以通过关闭提取功能来避免可能产生的 Cloud Logging 费用。默认情况下,Fleet Engine 日志会路由到 _Default 日志存储分区。
以下命令会更新“_Default”日志存储分区,使其不会提取 Fleet Engine 日志。
gcloud logging sinks update _Default \
--log-filter='NOT LOG_ID("cloudaudit.googleapis.com/activity") \
AND NOT LOG_ID("externalaudit.googleapis.com/activity") \
AND NOT LOG_ID("cloudaudit.googleapis.com/system_event") \
AND NOT LOG_ID("externalaudit.googleapis.com/system_event") \
AND NOT LOG_ID("cloudaudit.googleapis.com/access_transparency") \
AND NOT LOG_ID("externalaudit.googleapis.com/access_transparency") \
AND NOT resource.type:"fleetengine.googleapis.com"'
另请参阅根据预算管理 Cloud Logging 费用的四个步骤。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-25。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-02-25。"],[[["When logging is enabled, you are responsible for routing, storage, and retention, which might incur extra Google Cloud costs if usage and retention limits for no charge are exceeded."],["You can reduce logging costs by limiting ingested data, excluding specific log entries, routing logs to other destinations, or turning off log ingestion entirely."],["If you choose to route logs to external destinations, ensure to turn off log ingestion to avoid extra charges."],["To completely avoid Fleet Engine logging charges when you don't intend to use the logs, turn off ingestion for the _Default log bucket."]]],["After enabling logging, you can manage costs by controlling log ingestion and retention. To reduce costs, limit ingested data by excluding specific log entries, like `GetVehicle` logs, using commands such as `gcloud logging sinks update`. You can also route logs to other destinations, avoiding default storage costs, by using Cloud Logging Exports. To completely prevent charges, you can turn off log ingestion using the provided command to update the `_Default` logging bucket to ignore specified logs including `fleetengine.googleapis.com`.\n"]]