Google Workspace
Collect Workspace login, admin, OAuth token and Drive audit events with a delegated service account
Collect Google Workspace audit events to search login, admin, OAuth token, and Drive activity in nano. The collector reads those streams through the Reports API with a service account you own and domain-wide delegation. Each stream has its own log source and uses the google_workspace_ocsf parser. Collected events pass through that source's pipeline before they are stored.
1. Create a delegated service account
-
Create a Google service account under your control and enable domain-wide delegation for it.
-
As a Google Workspace administrator, open Google Admin console → Security → API controls → Domain-wide delegation (under Access and data control in some layouts). Add that account's numeric client ID and authorize exactly this scope:
https://www.googleapis.com/auth/admin.reports.audit.readonly -
Create a JSON key for the service account.
-
Choose an active Workspace super-admin in the domain that granted delegation. This is the identity the collector impersonates, not the service account itself. Allow the delegation change to propagate before diagnosing a fresh authorization failure.
2. Add a pull feed
Publish the google_workspace_ocsf parser for each stream's log source under Ingestion → Log Sources. Then open Ingestion → Log Sources → Pull feeds, add a Google Workspace feed, and enter:
| Credential/config | Value |
|---|---|
| Service account key | Paste the JSON key. Its private_key and client_email are stored in the credentials store and never shown again. |
Admin to impersonate (ADMIN_EMAIL) | Active super-admin in the delegated Workspace, for example admin@example.com |
STREAMS | The applications to collect: login, admin, token, drive |
On Self-run you can instead install Google Workspace from the Marketplace and supply the same key and admin email under Connections → Connect tenant. See SaaS Collectors.
3. Verify delivery
Check the feed's last status and error on Pull feeds, then search for stored events:
metadata.log_source="gws_login" | head 20Use the stream's source label below for other streams. If no events appear, check whether Workspace has produced recent activity, then inspect delegation and feed errors.
Streams
| Stream | Source label | Notes |
|---|---|---|
login | gws_login | Sign-ins, failures, suspicious-login flags, and logout |
admin | gws_admin | Administrative changes |
token | gws_token | Third-party app authorizations and granted scopes |
drive | gws_drive | File access and sharing; can be high volume, so enable it deliberately |
The spec polls every five minutes, with a ten-minute run budget. It walks windows of up to one hour, delays the upper boundary by 60 seconds, and re-reads a ten-minute overlap to catch Google's late events. Windows checkpoint after their pages are walked; ingestion is at-least-once, so do not assume zero duplicates. Events are deduplicated by application, customer, unique qualifier and time.
Troubleshoot
Need help with these checks? Contact support with the deployment, request ID and time with timezone.
Delegation or collection fails
- Unauthorized client or scope: authorize this service account's numeric client ID in this Workspace with the exact audit-readonly scope, and allow for propagation.
- Invalid subject:
ADMIN_EMAILmust be an active user of the Workspace that authorized the client ID. Check spelling, suspension and deleted accounts. - Reports API permission error after the token exchange: check the impersonated admin's access; not every 403 is a delegation error.
Share status codes and feed names when troubleshooting, never keys, tokens, or signed assertions. Map fields in the parser.