This document describes audit logging for Cloud Firestore with MongoDB compatibility. Google Cloud services generate audit logs that record administrative and access activities within your Google Cloud resources.
For more information about Cloud Audit Logs, see the following:
- Types of audit logs
- Audit log entry structure
- Storing and routing audit logs
- Cloud Logging pricing summary
- Enable Data Access audit logs
Notes
When configuring audit logging, use the service name datastore.googleapis.com 
to configure both datastore.googleapis.com 
and firestore.googleapis.com.
Once configured, logs for the Cloud Firestore with MongoDB compatibility API include the service name 
firestore.googleapis.com`.
To view the time it took to process a DATA_READ 
or DATA_WRITE 
request, see
the processing_duration 
field within the metadata 
object of an AuditLog 
.
The processing_duration 
field describes the time the database took to process
a request. This is smaller than the end-user latency. In particular, it does
not include network overhead.
Service name
 Cloud Firestore 
audit logs use the service name firestore.googleapis.com 
.
Filter for this service:
 protoPayload.serviceName="firestore.googleapis.com" 
 
Methods by permission type
Each IAM permission has a type 
property, whose value is an enum
that can be one of four values: ADMIN_READ 
, ADMIN_WRITE 
, DATA_READ 
, or DATA_WRITE 
. When you call a method, Cloud Firestore 
generates an audit log whose category is dependent on the type 
property of the permission required to perform the method.
Methods that require an IAM permission with the type 
property
value of DATA_READ 
, DATA_WRITE 
, or ADMIN_READ 
generate Data Access 
audit logs.
Methods that require an IAM permission with the type 
property
value of ADMIN_WRITE 
generate Admin Activity 
audit logs.
| Permission type | Methods | 
|---|---|
| ADMIN_READ | google.cloud.location.Locations.GetLocationgoogle.cloud.location.Locations.ListLocationsgoogle.firestore.admin.v1.FirestoreAdmin.GetBackupgoogle.firestore.admin.v1.FirestoreAdmin.GetBackupSchedulegoogle.firestore.admin.v1.FirestoreAdmin.GetDatabasegoogle.firestore.admin.v1.FirestoreAdmin.GetFieldgoogle.firestore.admin.v1.FirestoreAdmin.GetIndexgoogle.firestore.admin.v1.FirestoreAdmin.ListBackupSchedulesgoogle.firestore.admin.v1.FirestoreAdmin.ListBackupsgoogle.firestore.admin.v1.FirestoreAdmin.ListDatabasesgoogle.firestore.admin.v1.FirestoreAdmin.ListFieldsgoogle.firestore.admin.v1.FirestoreAdmin.ListIndexesgoogle.firestore.admin.v1beta1.FirestoreAdmin.GetIndexgoogle.firestore.admin.v1.MongoDBCompatible.ListIndexesgoogle.firestore.admin.v1.MongoDBCompatible.ListDatabases | 
| ADMIN_WRITE | google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedulegoogle.firestore.admin.v1.FirestoreAdmin.CreateDatabasegoogle.firestore.admin.v1.FirestoreAdmin.CreateIndexgoogle.firestore.admin.v1.FirestoreAdmin.DeleteBackupgoogle.firestore.admin.v1.FirestoreAdmin.DeleteBackupSchedulegoogle.firestore.admin.v1.FirestoreAdmin.DeleteDatabasegoogle.firestore.admin.v1.FirestoreAdmin.DeleteIndexgoogle.firestore.admin.v1.FirestoreAdmin.RestoreDatabasegoogle.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedulegoogle.firestore.admin.v1.FirestoreAdmin.UpdateDatabasegoogle.firestore.admin.v1.FirestoreAdmin.UpdateFieldgoogle.longrunning.Operations.CancelOperationgoogle.longrunning.Operations.DeleteOperation | 
| DATA_READ | google.firestore.v1.MongoDBCompatible.Findgoogle.firestore.v1.MongoDBCompatible.Aggregategoogle.firestore.v1.MongoDBCompatible.GetMoregoogle.firestore.v1.MongoDBCompatible.ListCollectionsgoogle.firestore.v1.MongoDBCompatible.Countgoogle.firestore.v1.MongoDBCompatible.Distinctgoogle.firestore.v1.MongoDBCompatible.CommitTransactiongoogle.firestore.v1.MongoDBCompatible.AbortTransactiongoogle.firestore.v1.MongoDBCompatible.EndSessionsgoogle.firestore.v1.MongoDBCompatible.KillCursors | 
| DATA_WRITE | google.firestore.v1.MongoDBCompatible.Insertgoogle.firestore.v1.MongoDBCompatible.Updategoogle.firestore.v1.MongoDBCompatible.Deletegoogle.firestore.v1.MongoDBCompatible.FindAndModifygoogle.firestore.v1.MongoDBCompatible.CreateCollection | 
Identify request callers
Audit Log entries include information about the identity that performed the
logged operation. To identify a request caller, see the following fields within
an  AuditLog 
 
object:
-  The caller's identity is held in the AuthenticationInfofield. This can include theprincipalEmailof the user. This information is sometimes redacted .
-  The callerIpfield within therequestMetadataobject of anAuditLogentry includes the IP address of the caller.

