每个 IAM 权限都有一个 type 属性,该属性的值是一个枚举,可以是以下四个值之一:ADMIN_READ、ADMIN_WRITE、DATA_READ 或 DATA_WRITE。当您调用某个方法时,Secret Manager 会生成一个审核日志,其类别取决于执行该方法所需权限的 type 属性。需要 IAM 权限且 type 属性值为 DATA_READ、DATA_WRITE 或 ADMIN_READ 的方法会生成数据访问审核日志。需要 IAM 权限且 type 属性值为 ADMIN_WRITE 的方法会生成管理员活动审核日志。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Secret Manager Audit Logging\n\nThis document describes audit logging for Secret Manager. Google Cloud services\ngenerate audit logs that record administrative and access activities within your Google Cloud resources.\nFor more information about Cloud Audit Logs, see the following:\n\n- [Types of audit logs](/logging/docs/audit#types)\n- [Audit log entry structure](/logging/docs/audit#audit_log_entry_structure)\n- [Storing and routing audit logs](/logging/docs/audit#storing_and_routing_audit_logs)\n- [Cloud Logging pricing summary](/stackdriver/pricing#logs-pricing-summary)\n- [Enable Data Access audit logs](/logging/docs/audit/configure-data-access)\n\n\u003cbr /\u003e\n\nService name\n------------\n\nSecret Manager audit logs use the service name `secretmanager.googleapis.com`.\nFilter for this service: \n\n```gdscript\n protoPayload.serviceName=\"secretmanager.googleapis.com\"\n \n```\n\n\u003cbr /\u003e\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`,\n`DATA_READ`, or `DATA_WRITE`. When you call a method,\nSecret Manager 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 value\nof `DATA_READ`, `DATA_WRITE`, or `ADMIN_READ` generate\n[Data Access](/logging/docs/audit#data-access) audit logs.\n\nMethods that require an IAM permission with the `type` property value\nof `ADMIN_WRITE` generate\n[Admin Activity](/logging/docs/audit#admin-activity) audit logs.\n\nAPI interface audit logs\n------------------------\n\nFor information about how and which permissions are evaluated for each method,\nsee the Identity and Access Management documentation for Secret Manager.\n\n### `google.cloud.location.Locations`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.location.Locations`.\n\n#### `GetLocation`\n\n- **Method** : `google.cloud.location.Locations.GetLocation` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.locations.get - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.location.Locations.GetLocation\"\n ` \n\n#### `ListLocations`\n\n- **Method** : `google.cloud.location.Locations.ListLocations` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.locations.list - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.location.Locations.ListLocations\"\n ` \n\n### `google.cloud.secretmanager.v1.SecretManagerService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.secretmanager.v1.SecretManagerService`.\n\n#### `AccessSecretVersion`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.versions.access - DATA_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion\"\n ` \n\n#### `AddSecretVersion`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.versions.add - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion\"\n ` \n\n#### `CreateSecret`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.CreateSecret` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.secrets.create - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.CreateSecret\"\n ` \n\n#### `DeleteSecret`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.secrets.delete - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret\"\n ` \n\n#### `DestroySecretVersion`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.versions.destroy - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion\"\n ` \n\n#### `DisableSecretVersion`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.versions.disable - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion\"\n ` \n\n#### `EnableSecretVersion`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.versions.enable - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion\"\n ` \n\n#### `GetIamPolicy`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.GetIamPolicy` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.secrets.getIamPolicy - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.GetIamPolicy\"\n ` \n\n#### `GetSecret`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.GetSecret` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.secrets.get - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.GetSecret\"\n ` \n\n#### `GetSecretVersion`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.versions.get - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion\"\n ` \n\n#### `ListSecretVersions`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.versions.list - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions\"\n ` \n\n#### `ListSecrets`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.ListSecrets` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `secretmanager.secrets.list - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.ListSecrets\"\n ` \n\n#### `SetIamPolicy`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.SetIamPolicy` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.secrets.setIamPolicy - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.SetIamPolicy\"\n ` \n\n#### `UpdateSecret`\n\n- **Method** : `google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret` \n- **Audit log type** : [Admin activity](/logging/docs/audit#admin-activity) \n- **Permissions** :\n - `secretmanager.secrets.update - ADMIN_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret\"\n ` \n\nMethods that don't produce audit logs\n-------------------------------------\n\nA method might not produce audit logs for one or more of the following\nreasons:\n\n- It is a high volume method involving significant log generation and storage costs.\n- It has low auditing value.\n- Another audit or platform log already provides method coverage.\n\n\u003cbr /\u003e\n\nThe following methods don't produce audit logs:\n\n- `google.cloud.secretmanager.v1.SecretManagerService.TestIamPermissions`\n\nWhat's next\n-----------\n\n- Learn more about detecting threats in Secret Manager by watching a short YouTube [video on audit logging](https://www.youtube.com/watch?v=y5LL2xpzVNI&t=5s)."]]