設定稽核記錄時,請使用服務名稱 datastore.googleapis.com
同時設定 datastore.googleapis.com 和 firestore.googleapis.com.
Once configured, logs for the Firestore with MongoDB compatibility API include the service namefirestore.googleapis.com。
[[["容易理解","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-04 (世界標準時間)。"],[],[],null,["# Audit logging information\n=========================\n\nThis document describes audit logging for 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-----\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 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------------\n\nFirestore 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--------------------------\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, 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\nIdentify request callers\n------------------------\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."]]