本文件說明 OS 登入 API 產生的稽核記錄。如要進一步瞭解使用 OS 登入服務所需的 IAM 權限,請參閱「設定 OS 登入」。
服務名稱
OS Login 稽核記錄會使用服務名稱 oslogin.googleapis.com。這項服務的篩選器:
protoPayload.serviceName="oslogin.googleapis.com"
依權限類型劃分的方法
每個 IAM 權限都有一個 type 屬性,其值是枚舉,可為四個值之一:ADMIN_READ、ADMIN_WRITE、DATA_READ 或 DATA_WRITE。當您呼叫方法時,OS 登入會產生稽核記錄,其類別取決於執行方法所需權限的 type 屬性。需要 DATA_READ、DATA_WRITE 或 ADMIN_READ 的 type 屬性值的 IAM 權限的程式會產生資料存取稽核記錄。需要 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"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eOS Login audit logs are automatically enabled and track connection attempts to virtual machine (VM) instances with OS Login and OS Login two-factor authentication (2FA).\u003c/p\u003e\n"],["\u003cp\u003eYou can query Cloud Audit Logs using the Google Cloud console or the \u003ccode\u003egcloud logging read\u003c/code\u003e command to view a list of OS Login connection attempts.\u003c/p\u003e\n"],["\u003cp\u003eReviewing the \u003ccode\u003emethodName\u003c/code\u003e and \u003ccode\u003eprincipalEmail\u003c/code\u003e fields in the audit logs reveals the types of connection attempts and the users involved, with specific \u003ccode\u003emethodName\u003c/code\u003e values like \u003ccode\u003eCheckPolicy\u003c/code\u003e, \u003ccode\u003eStartSession\u003c/code\u003e, and \u003ccode\u003eContinueSession\u003c/code\u003e indicating different connection stages.\u003c/p\u003e\n"],["\u003cp\u003eAudit log properties, such as \u003ccode\u003eserviceName\u003c/code\u003e, \u003ccode\u003eresourceName\u003c/code\u003e, \u003ccode\u003eseverity\u003c/code\u003e, \u003ccode\u003eauthenticationInfo.principalEmail\u003c/code\u003e, and \u003ccode\u003erequest.numericProjectId\u003c/code\u003e, provide detailed information about each login attempt.\u003c/p\u003e\n"],["\u003cp\u003eSpecific properties like \u003ccode\u003erequest.policy\u003c/code\u003e and \u003ccode\u003eresponse.success\u003c/code\u003e for \u003ccode\u003eCheckPolicy\u003c/code\u003e, \u003ccode\u003erequest.supportedChallengeTypes\u003c/code\u003e, \u003ccode\u003eresponse.authenticationStatus\u003c/code\u003e, and \u003ccode\u003eresponse.sessionId\u003c/code\u003e for \u003ccode\u003eStartSession\u003c/code\u003e, and \u003ccode\u003erequest.challengeId\u003c/code\u003e, \u003ccode\u003erequest.action\u003c/code\u003e, and \u003ccode\u003eresponse.challenges.status\u003c/code\u003e for \u003ccode\u003eContinueSession\u003c/code\u003e contain distinct information about each method.\u003c/p\u003e\n"]]],[],null,["# Monitor OS Login audit logs\n\n*** ** * ** ***\n\nThis document describes audit logging for OS Login. 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\nNotes\n-----\n\nThis document describes the audit logs generated by the OS Login API. For detailed information about the IAM permissions necessary to use the OS Login service, see [Set up OS Login](https://cloud.google.com/compute/docs/oslogin/set-up-oslogin#configure_users).\n\nService name\n------------\n\nOS Login audit logs use the service name `oslogin.googleapis.com`.\nFilter for this service: \n\n```gdscript\n protoPayload.serviceName=\"oslogin.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,\nOS Login 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](/compute/docs/oslogin/set-up-oslogin#configure_users) for OS Login.\n\n### `google.cloud.oslogin.controlplane.regional.v1alpha.OsLoginRegionalService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.oslogin.controlplane.regional.v1alpha.OsLoginRegionalService`.\n\n#### `SignSshPublicKey`\n\n- **Method** : `google.cloud.oslogin.controlplane.regional.v1alpha.OsLoginRegionalService.SignSshPublicKey` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.instances.osAdminLogin - ADMIN_READ`\n - `compute.instances.osLogin - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.controlplane.regional.v1alpha.OsLoginRegionalService.SignSshPublicKey\"\n ` \n\n### `google.cloud.oslogin.controlplane.regional.v1beta.OsLoginRegionalService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.oslogin.controlplane.regional.v1beta.OsLoginRegionalService`.\n\n#### `SignSshPublicKey`\n\n- **Method** : `google.cloud.oslogin.controlplane.regional.v1beta.OsLoginRegionalService.SignSshPublicKey` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.instances.osAdminLogin - ADMIN_READ`\n - `compute.instances.osLogin - ADMIN_READ`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.controlplane.regional.v1beta.OsLoginRegionalService.SignSshPublicKey\"\n ` \n\n### `google.cloud.oslogin.dataplane.OsLoginDataPlaneService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.oslogin.dataplane.OsLoginDataPlaneService`.\n\n#### `ListLoginProfiles`\n\n- **Method** : `google.cloud.oslogin.dataplane.OsLoginDataPlaneService.ListLoginProfiles` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.dataplane.OsLoginDataPlaneService.ListLoginProfiles\"\n ` \n\n#### `CheckPolicy`\n\n- **Method** : `google.cloud.oslogin.dataplane.OsLoginDataPlaneService.CheckPolicy` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.dataplane.OsLoginDataPlaneService.CheckPolicy\"\n ` \n\n#### `StartSession`\n\n- **Method** : `google.cloud.oslogin.dataplane.OsLoginDataPlaneService.StartSession` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.dataplane.OsLoginDataPlaneService.StartSession\"\n ` \n\n#### `ContinueSession`\n\n- **Method** : `google.cloud.oslogin.dataplane.OsLoginDataPlaneService.ContinueSession` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.dataplane.OsLoginDataPlaneService.ContinueSession\"\n ` \n\n### `google.cloud.oslogin.v1.OsLoginService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.oslogin.v1.OsLoginService`.\n\n#### `ImportSshPublicKey`\n\n- **Method** : `google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.oslogin.updateExternalUser - DATA_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey\"\n ` \n\n### `google.cloud.oslogin.v1alpha.OsLoginService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.oslogin.v1alpha.OsLoginService`.\n\n#### `SignSshPublicKey`\n\n- **Method** : `google.cloud.oslogin.v1alpha.OsLoginService.SignSshPublicKey` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.oslogin.updateExternalUser - DATA_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.v1alpha.OsLoginService.SignSshPublicKey\"\n ` \n\n### `google.cloud.oslogin.v1beta.OsLoginService`\n\nThe following audit logs are associated with methods belonging to\n`google.cloud.oslogin.v1beta.OsLoginService`.\n\n#### `ImportSshPublicKey`\n\n- **Method** : `google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.oslogin.updateExternalUser - DATA_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey\"\n ` \n\n#### `ProvisionPosixAccount`\n\n- **Method** : `google.cloud.oslogin.v1beta.OsLoginService.ProvisionPosixAccount` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.oslogin.updateExternalUser - DATA_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.v1beta.OsLoginService.ProvisionPosixAccount\"\n ` \n\n#### `SignSshPublicKey`\n\n- **Method** : `google.cloud.oslogin.v1beta.OsLoginService.SignSshPublicKey` \n- **Audit log type** : [Data access](/logging/docs/audit#data-access) \n- **Permissions** :\n - `compute.oslogin.updateExternalUser - DATA_WRITE`\n- **Method is a long-running or streaming operation** : No. \n- **Filter for this method** : `\n protoPayload.methodName=\"google.cloud.oslogin.v1beta.OsLoginService.SignSshPublicKey\"\n ` \n\nMethods that don't produce audit logs\n-------------------------------------\n\nSeveral OS Login methods don't produce audit logs because they act on resources that are scoped\nto a user, and not to a project, folder, or organization.\n\nThe following methods don't produce audit logs:\n\n- `google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey`\n- `google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount`\n- `google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey`\n- `google.cloud.oslogin.v1.OsLoginService.GetLoginProfile`\n- `google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey`\n- `google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey`\n- `google.cloud.oslogin.v1alpha.OsLoginService.CreateSshPublicKey`\n- `google.cloud.oslogin.v1alpha.OsLoginService.DeletePosixAccount`\n- `google.cloud.oslogin.v1alpha.OsLoginService.DeleteSshPublicKey`\n- `google.cloud.oslogin.v1alpha.OsLoginService.GetLoginProfile`\n- `google.cloud.oslogin.v1alpha.OsLoginService.GetSshPublicKey`\n- `google.cloud.oslogin.v1alpha.OsLoginService.ProvisionPosixAccount`\n- `google.cloud.oslogin.v1alpha.OsLoginService.UpdateSshPublicKey`\n- `google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey`\n- `google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount`\n- `google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey`\n- `google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile`\n- `google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey`\n- `google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey`\n\nWhat's next?\n------------\n\n- Learn more about [Logging query language](/logging/docs/view/logging-query-language) to customize your OS Login audit log queries.\n- Learn how [SSH connections to Linux VMs](/compute/docs/instances/ssh) work on Compute Engine."]]