Skip to content

Commit 37fb8e1

Browse files
google_workspace: add support for Gmail events (#14399)
This adds support for the Gmail logs as a new data stream to enhance the overall visibility of data in the Google Workspace integration. This changes includes updating navigation links in to the relevant dashboards. Sanitized test case inputs were obtained from a live Google Workspace instance using the BigQuery API[1]. The schema for Gmail logs can be found in the documentation[2]. [1] https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs [2] https://support.google.com/a/answer/12384955
1 parent b862842 commit 37fb8e1

29 files changed

+5970
-41
lines changed

packages/google_workspace/_dev/build/docs/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,93 @@ Click the Advanced option of Google Workspace Audit Reports. The default value o
5353

5454
> NOTE: The `Delegated Account` value in the configuration, is expected to be the email of the administrator account, and not the email of the ServiceAccount.
5555
56+
# Google Workspace Gmail Logs
57+
58+
The integration collects and parses Gmail audit logs data available for reporting in Google Workspace. You must first export Google Workspace logs to Google BigQuery. This involves exporting all activity log events and usage reports to Google BigQuery. Only certain Google Workspace editions support this feature. For more details see [About reporting logs and BigQuery](https://support.google.com/a/answer/9079364?hl=en). The integration uses the [BigQuery API](https://cloud.google.com/bigquery/docs/reference/rest) to query logs from BigQuery.
59+
60+
## Requirements
61+
62+
In order to ingest data from the Google BigQuery API, you must:
63+
64+
1. Enable BigQuery API if not already
65+
66+
- In the [Google Cloud console](https://console.cloud.google.com), navigate to **APIs & Services > Library**.
67+
- Search for **BigQuery API** and select it.
68+
- Click **Enable**.
69+
70+
2. Create a service account:
71+
72+
- In the [Google Cloud console](https://console.cloud.google.com), navigate to **APIs & Services > Credentials**.
73+
- Click Create **Credentials > Service account**.
74+
- In the setup:
75+
- Enter a name for the service account.
76+
- Click **Create and Continue**.
77+
- (Optional) Grant project access.
78+
- Click **Continue**.
79+
- (Optional) Grant user access.
80+
- Click **Done**.
81+
82+
3. Generate a JSON Key:
83+
84+
- From the **Credentials** page, click on the name of your new service account.
85+
- Go to the **Keys** tab.
86+
- Click **Add Key > Create new key**.
87+
- Choose **JSON** format and click **Create**.
88+
- Save the downloaded JSON key securely.
89+
90+
4. Grant IAM Role to service account:
91+
92+
- Go to **IAM & Admin > IAM** in the Cloud Console.
93+
- Click **Grant access**.
94+
- Paste the service account email in the **New principals** field.
95+
- Click **Select a role**, search for and select **BigQuery Job User**.
96+
- Click **Save**.
97+
98+
5. Set up a BigQuery project for reporting logs
99+
100+
- Go to **IAM & Admin page** for your project.
101+
- Add a project editor for your project.
102+
- Click **Grant access**.
103+
- Enter `[email protected]` in the **New principals** field.
104+
- In **Select a role**, select **Project**, then **Editor**.
105+
- Click **Save**.
106+
- Add a Google Workspace administrator account as a project editor by following the same steps above.
107+
- For more details see [Set up a BigQuery project for reporting logs](https://support.google.com/a/answer/9082756?hl=en)
108+
109+
5. Set up a BigQuery Export configuration:
110+
111+
- Sign in to your [Google Admin console](https://admin.google.com) with a super administrator account.
112+
- Navigate to **Reporting > Data Integrations** (Requires having the **Reports** administrator privilege).
113+
Education administrators go to Menu **Reporting > BigQuery export**, which opens the **Data integrations** page.
114+
- Point to the **BigQuery Export** card and click Edit.
115+
- To activate BigQuery logs, check the **Enable Google Workspace data export to Google BigQuery** box.
116+
- (Optional) To export sensitive parameters of DLP rules, check the **Allow export of sensitive content from DLP rule logs** box.
117+
- Under **BigQuery project ID**, select the project where you want to store the logs.
118+
Choose a project for which `[email protected]` has an editor role.
119+
- Under **New dataset within project**, enter the name of the dataset to use for storing the logs in the project.
120+
A new dataset will be created with this name in your BigQuery project.
121+
- (Optional) Check the **Restrict the dataset to a specific geographic location** box > select the location from the menu.
122+
- Click **Save**.
123+
- For more details see [Set up a BigQuery Export configuration](https://support.google.com/a/answer/9079365?hl=en).
124+
125+
6. Grant Dataset Permissions:
126+
127+
- Go to [Google Cloud console](https://console.cloud.google.com) and search for **BigQuery**.
128+
- Click your Google Cloud project on the left pane.
129+
- Locate the dataset, click the **three-dot menu > Share > Manage Permissions**.
130+
- Click **Add principal**.
131+
- Paste the service account email in **New principals**.
132+
- Select **BigQuery Data Viewer** as the role.
133+
- Click **Save**.
134+
135+
This integration will make use of the following *oauth2 scope*:
136+
137+
- `https://www.googleapis.com/auth/bigquery`
138+
139+
Once you have downloaded your service account credentials as a JSON file, you are ready to set up your integration for collecting Gmail logs.
140+
141+
> NOTE: For Gmail data stream, the default value of "BigQuery API Host" is `https://bigquery.googleapis.com`. The BigQuery API Host will be used for collecting gmail logs only.
142+
56143
# Google Workspace Alert
57144

58145
The [Google Workspace](https://developers.google.com/admin-sdk/alertcenter) Integration collects and parses data received from the Google Workspace Alert Center API using HTTP JSON Input.
@@ -319,3 +406,11 @@ This is the `keep` dataset.
319406
{{event "keep"}}
320407

321408
{{fields "keep"}}
409+
410+
### Gmail
411+
412+
This is the `gmail` dataset.
413+
414+
{{event "gmail"}}
415+
416+
{{fields "gmail"}}

0 commit comments

Comments
 (0)