When a Google Cloud audit log says a service account made a change, the real question is who or what was holding that service account's credentials at the time. The answer sits in a handful of fields inside protoPayload.authenticationInfo: principalEmail, principalSubject, serviceAccountKeyName and the serviceAccountDelegationInfo array. This guide explains what each field means according to Google's AuditLog reference, how to read an impersonation chain from start to finish, how keys, impersonation and workload identity federation each look in the logs, and which detections to build. It is written for GCP security engineers and SOC analysts. Log types, retention and sinks are covered in the Google Cloud Audit Logs and Log Sinks Guide, so this page goes straight to the identity fields.
This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google. Product features change, so confirm settings against Google Cloud's current documentation.
Key takeaways
- principalEmail is the identity the token represents: after impersonation it shows the service account, not the human or workload that obtained the token.
- serviceAccountDelegationInfo names the real caller: each entry carries a
firstPartyPrincipal.principalEmailfor a Google identity or aprincipalSubjectfor a federated one. - serviceAccountKeyName means a key was used: its presence shows a downloaded or uploaded service account key created the credential, which no delegation field can trace back to a person.
- The token minting step is a Data Access log:
GenerateAccessTokenand STSExchangeTokenentries only appear if Data Access audit logs are enabled for the IAM and Security Token Service APIs. - Know which services record which fields: Google notes that App Engine and Google Kubernetes Engine do not log the identity that created short-lived credentials, and App Engine and Compute Engine do not log the key name.
Where principal information lives in an audit log entry
Every Cloud Audit Logs entry is a LogEntry whose protoPayload holds an AuditLog object of type type.googleapis.com/google.cloud.audit.AuditLog. The logName ends in cloudaudit.googleapis.com%2Factivity, %2Fdata_access, %2Fsystem_event or %2Fpolicy. Identity information is in authenticationInfo; what was attempted and whether it was allowed is in authorizationInfo; network context is in requestMetadata.
| Field | Meaning (from Google's AuditLog reference) | How analysts use it |
|---|---|---|
authenticationInfo.principalEmail | The email address of the authenticated user, or of the service account acting on behalf of a third-party principal, making the request | The identity whose permissions were used |
authenticationInfo.principalSubject | String representation of the requesting party's identity, populated for first-party and third-party identities | Identifies federated callers that have no email address |
authenticationInfo.serviceAccountKeyName | The name of the service account key used to create or exchange credentials, as a full resource name | Shows key-based access and which key |
authenticationInfo.serviceAccountDelegationInfo[] | Identity delegation history of an authenticated service account that makes the request | Finds the identity behind an impersonated service account |
authenticationInfo.thirdPartyPrincipal | Third-party identification, if any, of the authenticated user | External identity context |
authenticationInfo.serviceDelegationHistory | History of delegated resource access across Google services, as a result of the original user's action | Explains a Google service acting for a user; distinct from impersonation |
authenticationInfo.oauthInfo.oauthClientId | The OAuth client ID of the first-party or third-party application acting on behalf of the user | Ties activity to an OAuth application |
authorizationInfo[].permission, .granted, .resource | The IAM permission required, whether it was granted, and the resource | Separates attempts from successes |
requestMetadata.callerIp, .callerSuppliedUserAgent | Source address and user agent reported for the call | Location and tooling context; user agent is caller supplied |
Google's audit logging overview states that the caller's principal email is not redacted for successful access or for any write operation. For read-only operations that fail with permission denied, the email might be redacted unless the caller is a service account, and some services (BigQuery, Cloud Storage usage-log entries, VPC Service Controls and Organization Policy denials) apply their own redaction rules.
principalEmail and principalSubject
- Human user:
principalEmailis the user's Google or Cloud Identity address and there is no delegation array. - Service account using its own attached credentials:
principalEmailis the service account email, with no key name and no delegation array. The workload it is attached to (a VM, Cloud Run service or function) is the actor. - Service account through a key:
principalEmailis the service account andserviceAccountKeyNameholds a value of the form//iam.googleapis.com/projects/PROJECT_ID/serviceAccounts/SA_EMAIL/keys/KEY_ID. - Federated principal acting directly:
principalSubjectcarries the federated identity. Google's reference gives the formatprincipal://iam.googleapis.com/{identity pool name}/subject/{subject}, with a legacyserviceAccount:{identity pool name}[{subject}]form still used for certain GKE identity types.
The practical rule: never stop at principalEmail when it ends in gserviceaccount.com. Check the key name and the delegation array before deciding who acted.
serviceAccountDelegationInfo and impersonation chains
Impersonation produces two kinds of entries, and you need both. Google's service account audit logging examples show the pattern.
- The minting entry. A caller with Service Account Token Creator (
roles/iam.serviceAccountTokenCreator) callsGenerateAccessTokenoniamcredentials.googleapis.com. This is written to thedata_accesslog, only if IAM Data Access audit logs are enabled. HereprincipalEmailis the caller, andresource.labels.email_id(withresource.typeservice_account) is the service account being impersonated. - The action entry. The caller uses the short-lived token, for example to create a Pub/Sub topic, which lands in the
activitylog. NowprincipalEmailis the impersonated service account andserviceAccountDelegationInfo[].firstPartyPrincipal.principalEmailis the user who created the credentials.
An annotated, generic action entry (values replaced with placeholders) looks like this:
1 Sample only, based on the public documentation cited. Assess it independently against the current official documentation, test outside production and back up first.
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"serviceName": "pubsub.googleapis.com",
"methodName": "google.pubsub.v1.Publisher.CreateTopic",
"authenticationInfo": {
"principalEmail": "deploy-sa@PROJECT_ID.iam.gserviceaccount.com", // identity whose permissions were used
"serviceAccountDelegationInfo": [
{ "firstPartyPrincipal": { "principalEmail": "[email protected]" } } // who minted the token
]
},
"authorizationInfo": [ { "permission": "pubsub.topics.create", "granted": true } ],
"requestMetadata": { "callerIp": "203.0.113.10" }
}For a federated workload, the entry inside the array carries principalSubject (a principal:// value) instead of firstPartyPrincipal.
Reading a chain step by step
- Start at the action: note
principalEmail,methodName, the resource and the timestamp. - Classify the credential: key name present means key-based access; delegation array present means impersonation; neither means attached credentials or a direct user.
- Read every delegation entry: record each
firstPartyPrincipal.principalEmailorprincipalSubject. Google's examples show a single entry, so in multi-hop chains treat the array as the set of identities involved and confirm order from the minting entries rather than assuming it. - Find the minting entry: search
data_accessforGenerateAccessTokenwhereresource.labels.email_idmatches the service account, shortly before the action. ItsprincipalEmailorprincipalSubjectis the caller at that hop. - Follow intermediate hops: delegated requests pass through intermediate service accounts listed in the
delegatesfield, and each account must hold Token Creator on the next. Repeat the search for each intermediate account. - For federated callers, go one step further: find the STS
ExchangeTokenentry, whoseprincipalSubjectis the external identity provider's subject (for example an AWS role ARN, an Azure managed identity object ID or an OIDCsubclaim) and whosemetadata.mapped_principalis theprincipal://form. - Check token lifetime: access tokens default to a maximum of one hour, extendable to 12 hours only for service accounts listed in the
constraints/iam.allowServiceAccountCredentialLifetimeExtensionorganisation policy. Actions long after the minting entry point to another token.
To find who could impersonate a service account in the first place, use How to Audit GCP Service Account Impersonation Rights.
Service account keys versus impersonation versus workload identity federation
| Access method | principalEmail on the action | Distinguishing field | Earlier entry to find | Attribution to a person or workload |
|---|---|---|---|---|
| Attached service account (VM, Cloud Run, function) | Service account | None of the below | Workload deployment history | Through the resource it is attached to |
| Service account key | Service account | serviceAccountKeyName | google.iam.admin.v1.CreateServiceAccountKey in activity | Only as far as who created or holds the key |
| Impersonation by a Google identity | Service account | serviceAccountDelegationInfo[].firstPartyPrincipal.principalEmail | GenerateAccessToken in data_access | Direct, in the action entry |
| Workload identity federation with impersonation | Service account | serviceAccountDelegationInfo[].principalSubject | STS ExchangeToken and GenerateAccessToken in data_access | To the external identity provider subject |
| Workload identity federation, direct resource access | Federated identity | principalSubject | STS ExchangeToken | To the external subject |
Keys are the weakest link for attribution: once a key file is copied, every holder looks identical in the logs. That is why the Google Cloud Service Account Keys Security Guide and the Workload Identity Federation Guide recommend replacing keys with federation or attached identities where possible.
Enabling the logs you need
Admin Activity and System Event logs are always written. Data Access logs are disabled by default except for BigQuery. To see the minting step, enable Data Access audit logs for the IAM APIs; for federation, Google's workload identity examples call for the Admin Read log type on both the IAM API and the Security Token Service API. Roll this out in stages:
- Enable Data Access logs for
iamcredentials.googleapis.comandsts.googleapis.comat organisation level in a test folder first, and measure volume. - Confirm entries appear by impersonating a test service account and exchanging a test federated token.
- Extend to the whole organisation and route the logs to your aggregated sink and SIEM.
- If volume or cost is a problem, use exclusion filters on low-value methods rather than disabling the service; roll back by removing the audit configuration for the service.
Detection use cases
| Detection | Logic | ATT&CK |
|---|---|---|
| Human impersonating a production service account | GenerateAccessToken where caller is a user and target is in a production project; or action entries with a user in the delegation array outside change windows | T1550.001 Application Access Token |
| Token Creator granted | SetIamPolicy adding roles/iam.serviceAccountTokenCreator, especially at project or folder level | T1098.001 Additional Cloud Credentials (related persistence) |
| New service account key | google.iam.admin.v1.CreateServiceAccountKey in activity; alert on any where key creation should be blocked | T1098.001 Additional Cloud Credentials |
| Key used from an unexpected network | Entries with serviceAccountKeyName and a callerIp outside known ranges | T1078.004 Cloud Accounts |
| Dormant key suddenly active | First appearance of a serviceAccountKeyName value after a long gap | T1078.004 Cloud Accounts |
| Unexpected federated subject | ExchangeToken with a principalSubject not in the expected list for that provider | T1078.004 Cloud Accounts |
Metrics that show the logging works:
- Attribution rate: share of service account actions in production attributable to a named workload, human or federated subject.
- Key-based share: percentage of service account API calls carrying
serviceAccountKeyName, trending down. - Minting coverage: share of impersonated action entries with a matching
GenerateAccessTokenentry found. - Token Creator grants reviewed: new grants triaged within one working day.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev. 5 | AU-2 Event Logging; AU-6 Audit Record Review; AU-9 Protection of Audit Information; AC-6 Least Privilege | Enabling, reviewing and protecting identity logs; limiting Token Creator |
| NIST CSF 2.0 | PR.PS-04; DE.CM-09 | Log generation and monitoring of runtime activity |
| MITRE ATT&CK v20 | T1078.004; T1550.001; T1098.001 | Abuse of cloud accounts, tokens and added credentials |
Common failure patterns
- Stopping at principalEmail: incident timelines that name a service account as the actor without checking the delegation array, so the real user is never identified.
- Data Access logs never enabled: action entries show a user in the delegation array, but there is no minting entry to show when, from where or through which intermediate accounts.
- Federation without STS logs: the
principal://subject is visible but the external identity and provider are not, because Admin Read logging was not enabled for the Security Token Service API. - Keys left in service: long-lived keys make attribution impossible; enforce the
iam.disableServiceAccountKeyCreationorganisation policy constraint where workloads do not need keys. - Expecting fields a service does not record: analysts expect delegation details from App Engine or GKE, or key names from Compute Engine, where Google says they are not logged; plan compensating evidence such as deployment records.
- Broad Token Creator grants: granting the role at project or folder level lets one compromised identity impersonate many service accounts. See the Google Cloud IAM and Service Accounts Guide.
Practitioner checklist
- Enable Data Access audit logs for the IAM credentials and Security Token Service APIs across the organisation.
- Route all audit logs to an aggregated sink your SOC can query.
- Teach analysts to check
serviceAccountKeyNameandserviceAccountDelegationInfoon every service account action. - Build a saved query that joins action entries to
GenerateAccessTokenminting entries by service account and time. - Alert on Token Creator grants, new service account keys and unexpected federated subjects.
- Track and reduce key-based API calls; block key creation by organisation policy where possible.
- Record which services Google documents as not logging the creating identity or key name, and gather deployment evidence for them.
- Review Token Creator holders regularly and scope grants to individual service accounts.
Standards and references
- Google Cloud: AuditLog reference (AuthenticationInfo, ServiceAccountDelegationInfo)
- Google Cloud: Examples of logs for service accounts
- Google Cloud: Examples of logs for Workload Identity Federation
- Google Cloud: Create short-lived credentials (delegated requests)
- Google Cloud: Cloud Audit Logs overview
- Google Cloud: Understanding audit logs
- Google Cloud: IAM audit logging
- MITRE ATT&CK: Application Access Token
Related NHI Mgmt Group resources: Google Cloud Audit Logs and Log Sinks Guide, How to Audit GCP Service Account Impersonation Rights, How to Find GCP Service Accounts With Owner or Editor Roles, Workload Identity Federation Guide, Google Cloud Service Account Keys Security Guide