Configure Gmail Message Tracking
This guide outlines the process of configuring the Google Cloud Console to prepare for setting up the Gmail Message Tracking Beat.
Set Up Project and Roles for Gmail Message Tracking Beat
Step 1: Create or Choose a GCP Project
Login to the Google Cloud Console.
Click the Project dropdown (top navigation bar) and either:
Select an existing project, or
Click New Project, provide a Project Name, and click Create.
Enable billing for this project (required for BigQuery).
As a best practice, we recommend creating a separate project for Gmail logs.
Step 2: Create a Custom Role for the Project
Open the GCP Console: https://console.cloud.google.com
In the left navigation menu, click IAM & Admin, and then click Roles.
Click Create Role at the top.
Fill in the following:
Title: (e.g., BigQueryLogReader)
ID: Auto-generated or customize.
Description: (e.g., Read access to Gmail logs in BigQuery)
Under Permissions, click Add Permissions.
Add the following permissions:
bigquery.datasets.get
bigquery.datasets.list
bigquery.tables.get
bigquery.tables.list
bigquery.tables.getData
bigquery.jobs.create
Click Add.
Click Create to save the custom role.
Step 3: Enable BigQuery API
Go to the BigQuery API Page within the Google Cloud Console.
Click Enable.
Step 4: Grant IAM Roles to Service Account
From the Google Cloud Console, go to IAM & Admin > IAM.
Click Grant Access at the top of the IAM table.
In the New Principals field, enter:
gapps-reports@system.gserviceaccount.com
Under Role, select BigQuery > BigQuery Data Editor.
Click Save.
Generate a Credential File
To collect Gmail Message Tracking logs with the Open Collector, a credentials file is required in the Beats configuration.
To configure and generate the credentials file:
Open the GCP Console.
Navigate to IAM & Admin > Service Accounts.
Click Create Service Account.
Enter a Name and an optional Description.
Click Create and Continue.
In the Grant access to this service account step, click Select a role.
Choose Custom, and then select the role created in Step 2.
Click Continue and then Done.
On the Service Accounts page, find your newly created account and click the three-dot menu, and then Manage keys.
Click Add Key, and then Create new key.
Select JSON and click Create.
The JSON key file is downloaded automatically.
Keep this JSON key file secure, as it contains API credentials used for authentication.
To export data to BigQuery, VPC service controls must be turned off (default setting) in the BigQuery project for Gmail. For more information, refer to Google’s VPC Service Controls documentation.
Assign Gmail Logs to a BigQuery Dataset
Gmail logs store records for each stage of a message in the Gmail delivery process. To analyze Gmail flow through the delivery process, assign Gmail logs to a dataset in a BigQuery project. After you assign Gmail logs, you can review reports.
To assign Gmail logs to a dataset in BigQuery:
Sign in to the Google Admin console using a super administrator account.
From the Admin console Home page, go to Reporting > Data integrations.
On the BigQuery Export card, click Edit.
Check the box for Enable Google Workspace data export to Google BigQuery.
(Optional) To export sensitive content from DLP rule logs, check Allow export of sensitive content from DLP rule logs.
Under BigQuery project ID, select the project where logs will be stored.
Ensuregapps-reports@system.gserviceaccount.com
has theEditor
role in this project.Under the New dataset within project, enter a unique name for the dataset (e.g.,
workspace_logs
).
Google will automatically create the new dataset.

Click Save to apply the settings.
If you can’t save the project, go to the Google Cloud console, delete the new dataset, then save it again in the Admin console.
Google automatically creates the dataset in the selected BigQuery project within 24 hours.
You’ll start seeing logs under tables like:
activity_*
gmail_log_*
Once the dataset is created, go to BigQuery in GCP Console and:
Confirm the dataset exists.
Confirm
gapps-reports@system.gserviceaccount.com
has Editor access:
BigQuery > your dataset > ⋮ (3-dot menu) > Share > confirmgapps-reports@system.gserviceaccount.com
has Editor role.Confirm log tables start populating after ~24 hours.