Use cases → Admin and governance
Export user activity logs on a schedule with delegation
Automate periodic export of user activity logs for compliance or analysis using a delegated service account, avoiding manual pulls.
| Who it is for | Compliance, security, and IT teams responsible for regular user activity tracking. |
|---|---|
| APIs | Admin SDK |
| Typical scopes | admin.reports.audit.readonly |
The problem
Manual log exports are error-prone and often skipped, leaving gaps in audit trails and slowing down incident response or compliance checks. Automated scheduled exports ensure coverage, but must operate reliably across all users and event types.
How it works
- Configure a delegated service account with the correct audit log scope.
- Set up a scheduled job (e.g. Cloud Scheduler, cron) to trigger the export at the desired interval.
- Call the Admin SDK Reports API for each user and event type of interest, paginating as needed.
- Store the exported logs in a secure Drive folder or external storage for retention and processing.
What changes
Audit logs are consistently available for review, incident forensics, or compliance without manual intervention.
Questions people ask
How should the export window be set up to avoid missing logs?
Always re-fetch with a window that overlaps the previous export by several hours, and deduplicate events by unique ID. This compensates for API delays.
Can I export logs for all users in one call?
No; most activity types require per-user queries, and some endpoints page results. Plan for batching and rate limits.
Want this built?
This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.
Talk to us Or read the setup guideRelated use cases
Audit which third-party apps can read your mail
List every OAuth grant across the domain and find the retired tools still holding access.
Automate joiners, movers and leavers
Create accounts, set group membership, provision Drive and hand over mailboxes without a manual checklist.
Continuously verify your delegation still works
A scheduled probe that proves every API still answers under every tenant, before a customer finds out otherwise.