现已推出具有 MongoDB 兼容性的 Firestore 企业版!
了解详情。
使用 Cloud Monitoring 監控資料庫
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
僅適用於 Cloud Firestore Enterprise 版。
|
本文說明與 MongoDB 相容的 Cloud Firestore 稽核記錄。Google Cloud 服務會產生稽核記錄,記錄 Google Cloud 資源中的管理和存取活動。
如要進一步瞭解 Cloud 稽核記錄,請參閱下列文章:
附註
設定稽核記錄時,請使用服務名稱 datastore.googleapis.com
同時設定 datastore.googleapis.com
和 firestore.googleapis.com.
Once configured, logs for the Cloud Firestore with MongoDB compatibility API include the service name
firestore.googleapis.com。
如要查看處理 DATA_READ
或 DATA_WRITE
要求所花的時間,請參閱 AuditLog
的 metadata
物件中的 processing_duration
欄位。processing_duration
欄位說明資料庫處理要求所花費的時間。這比使用者延遲時間還短。具體來說,這項費用不含網路額外負擔。
服務名稱
Cloud Firestore 稽核記錄會使用服務名稱 firestore.googleapis.com
。篩選這項服務:
protoPayload.serviceName="firestore.googleapis.com"
依權限類型劃分的方法
每個 IAM 權限都有 type
屬性,其值為列舉,可以是下列四個值之一:ADMIN_READ
、ADMIN_WRITE
、DATA_READ
或 DATA_WRITE
。呼叫方法時,Cloud Firestore 會產生稽核記錄,其類別取決於執行方法所需的權限的 type
屬性。
如果方法需要 IAM 權限,且 type
屬性值為 DATA_READ
、DATA_WRITE
或 ADMIN_READ
,系統就會產生「資料存取」稽核記錄。
如果方法需要 IAM 權限,且 type
屬性值為 ADMIN_WRITE
generate,系統就會產生管理員活動稽核記錄。
權限類型 |
方法 |
ADMIN_READ |
google.cloud.location.Locations.GetLocation
google.cloud.location.Locations.ListLocations
google.firestore.admin.v1.FirestoreAdmin.GetBackup
google.firestore.admin.v1.FirestoreAdmin.GetBackupSchedule
google.firestore.admin.v1.FirestoreAdmin.GetDatabase
google.firestore.admin.v1.FirestoreAdmin.GetField
google.firestore.admin.v1.FirestoreAdmin.GetIndex
google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules
google.firestore.admin.v1.FirestoreAdmin.ListBackups
google.firestore.admin.v1.FirestoreAdmin.ListDatabases
google.firestore.admin.v1.FirestoreAdmin.ListFields
google.firestore.admin.v1.FirestoreAdmin.ListIndexes
google.firestore.admin.v1beta1.FirestoreAdmin.GetIndex
google.firestore.admin.v1.MongoDBCompatible.ListIndexes
google.firestore.admin.v1.MongoDBCompatible.ListDatabases
|
ADMIN_WRITE |
google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedule
google.firestore.admin.v1.FirestoreAdmin.CreateDatabase
google.firestore.admin.v1.FirestoreAdmin.CreateIndex
google.firestore.admin.v1.FirestoreAdmin.DeleteBackup
google.firestore.admin.v1.FirestoreAdmin.DeleteBackupSchedule
google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase
google.firestore.admin.v1.FirestoreAdmin.DeleteIndex
google.firestore.admin.v1.FirestoreAdmin.RestoreDatabase
google.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedule
google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase
google.firestore.admin.v1.FirestoreAdmin.UpdateField
google.longrunning.Operations.CancelOperation
google.longrunning.Operations.DeleteOperation
|
DATA_READ |
google.firestore.v1.MongoDBCompatible.Find
google.firestore.v1.MongoDBCompatible.Aggregate
google.firestore.v1.MongoDBCompatible.GetMore
google.firestore.v1.MongoDBCompatible.ListCollections
google.firestore.v1.MongoDBCompatible.Count
google.firestore.v1.MongoDBCompatible.Distinct
google.firestore.v1.MongoDBCompatible.CommitTransaction
google.firestore.v1.MongoDBCompatible.AbortTransaction
google.firestore.v1.MongoDBCompatible.EndSessions
google.firestore.v1.MongoDBCompatible.KillCursors
|
DATA_WRITE |
google.firestore.v1.MongoDBCompatible.Insert
google.firestore.v1.MongoDBCompatible.Update
google.firestore.v1.MongoDBCompatible.Delete
google.firestore.v1.MongoDBCompatible.FindAndModify
google.firestore.v1.MongoDBCompatible.CreateCollection
|
識別要求發出者
稽核記錄項目包含執行記錄作業的身分相關資訊。如要識別要求呼叫端,請參閱 AuditLog
物件中的下列欄位:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\n\n|--------------------------------------------------------|\n| *Relevant to Cloud Firestore Enterprise edition only.* |\n\n\u003cbr /\u003e\n\nThis document describes audit logging for Cloud Firestore with MongoDB compatibility. Google Cloud\nservices generate audit logs that record administrative and access activities\nwithin your Google Cloud resources.\n\nFor more information about Cloud Audit Logs, see the following:\n\n- [Types of audit logs](https://cloud.google.com/logging/docs/audit#types)\n- [Audit log entry structure](https://cloud.google.com/logging/docs/audit#audit_log_entry_structure)\n- [Storing and routing audit logs](https://cloud.google.com/logging/docs/audit#storing_and_routing_audit_logs)\n- [Cloud Logging pricing summary](https://cloud.google.com/stackdriver/pricing#logs-pricing-summary)\n- [Enable Data Access audit logs](https://cloud.google.com/logging/docs/audit/configure-data-access)\n\nNotes\n\nWhen configuring audit logging, use the service name `datastore.googleapis.com`\nto configure both `datastore.googleapis.com` and `firestore.googleapis.com.\nOnce configured, logs for the Cloud Firestore with MongoDB compatibility API include the service name`firestore.googleapis.com\\`.\n\nTo view the time it took to process a `DATA_READ` or `DATA_WRITE` request, see\nthe `processing_duration` field within the `metadata` object of an `AuditLog`.\nThe `processing_duration` field describes the time the database took to process\na request. This is smaller than the end-user latency. In particular, it does\nnot include network overhead.\n\nService name\n\nCloud Firestore audit logs use the service name `firestore.googleapis.com`.\nFilter for this service: \n\n protoPayload.serviceName=\"firestore.googleapis.com\"\n\nMethods by permission type\n\nEach IAM permission has a `type` property, whose value is an enum\nthat can be one of four values: `ADMIN_READ`, `ADMIN_WRITE`, `DATA_READ`, or\n`DATA_WRITE`. When you call a method, Cloud Firestore generates an audit log whose category is dependent on the\n`type` property of the permission required to perform the method.\n\nMethods that require an IAM permission with the `type` property\nvalue of `DATA_READ`, `DATA_WRITE`, or `ADMIN_READ` generate\n[Data Access](https://cloud.google.com/logging/docs/audit/configure-data-access) audit logs.\n\nMethods that require an IAM permission with the `type` property\nvalue of `ADMIN_WRITE` generate\n[Admin Activity](https://cloud.google.com/logging/docs/audit#admin-activity) audit logs.\n\n| Permission type | Methods |\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ADMIN_READ` | `google.cloud.location.Locations.GetLocation` `google.cloud.location.Locations.ListLocations` `google.firestore.admin.v1.FirestoreAdmin.GetBackup` `google.firestore.admin.v1.FirestoreAdmin.GetBackupSchedule` `google.firestore.admin.v1.FirestoreAdmin.GetDatabase` `google.firestore.admin.v1.FirestoreAdmin.GetField` `google.firestore.admin.v1.FirestoreAdmin.GetIndex` `google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules` `google.firestore.admin.v1.FirestoreAdmin.ListBackups` `google.firestore.admin.v1.FirestoreAdmin.ListDatabases` `google.firestore.admin.v1.FirestoreAdmin.ListFields` `google.firestore.admin.v1.FirestoreAdmin.ListIndexes` `google.firestore.admin.v1beta1.FirestoreAdmin.GetIndex` `google.firestore.admin.v1.MongoDBCompatible.ListIndexes` `google.firestore.admin.v1.MongoDBCompatible.ListDatabases` |\n| `ADMIN_WRITE` | `google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedule` `google.firestore.admin.v1.FirestoreAdmin.CreateDatabase` `google.firestore.admin.v1.FirestoreAdmin.CreateIndex` `google.firestore.admin.v1.FirestoreAdmin.DeleteBackup` `google.firestore.admin.v1.FirestoreAdmin.DeleteBackupSchedule` `google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase` `google.firestore.admin.v1.FirestoreAdmin.DeleteIndex` `google.firestore.admin.v1.FirestoreAdmin.RestoreDatabase` `google.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedule` `google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase` `google.firestore.admin.v1.FirestoreAdmin.UpdateField` `google.longrunning.Operations.CancelOperation` `google.longrunning.Operations.DeleteOperation` |\n| `DATA_READ` | `google.firestore.v1.MongoDBCompatible.Find` `google.firestore.v1.MongoDBCompatible.Aggregate` `google.firestore.v1.MongoDBCompatible.GetMore` `google.firestore.v1.MongoDBCompatible.ListCollections` `google.firestore.v1.MongoDBCompatible.Count` `google.firestore.v1.MongoDBCompatible.Distinct` `google.firestore.v1.MongoDBCompatible.CommitTransaction` `google.firestore.v1.MongoDBCompatible.AbortTransaction` `google.firestore.v1.MongoDBCompatible.EndSessions` `google.firestore.v1.MongoDBCompatible.KillCursors` |\n| `DATA_WRITE` | `google.firestore.v1.MongoDBCompatible.Insert` `google.firestore.v1.MongoDBCompatible.Update` `google.firestore.v1.MongoDBCompatible.Delete` `google.firestore.v1.MongoDBCompatible.FindAndModify` `google.firestore.v1.MongoDBCompatible.CreateCollection` |\n\nIdentify request callers\n\nAudit Log entries include information about the identity that performed the\nlogged operation. To identify a request caller, see the following fields within\nan [`AuditLog`](https://cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog) object:\n\n- The caller's identity is held in the\n [`AuthenticationInfo`](https://cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog#AuthenticationInfo)\n field. This can include the `principalEmail` of the user. This information\n is [sometimes redacted](https://cloud.google.com/logging/docs/audit#user-id).\n\n- The `callerIp` field within the\n [`requestMetadata`](https://cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog#requestmetadata)\n object of an `AuditLog` entry includes the IP address of the caller."]]