Stream Google Cloud Platform logs into Microsoft Sentinel
Organizations are increasingly moving to multicloud architectures, whether by design or due to ongoing requirements. A growing number of these organizations use applications and store data on multiple public clouds, including the Google Cloud Platform (GCP).
This article describes how to ingest GCP data into Microsoft Sentinel to get full security coverage and analyze and detect attacks in your multicloud environment.
With the GCP Pub/Sub Audit Logs connector, based on our Codeless Connector Platform (CCP), you can ingest logs from your GCP environment using the GCP Pub/Sub capability.
Important
The GCP Pub/Sub Audit Logs connector is currently in PREVIEW. The Azure Preview Supplemental Terms include additional legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
Once you ingest the GCP data, you can view the details of three types of audit logs:
- Admin activity logs
- Data access logs
- Access transparency logs
With these, Google's Cloud Audit Logs records a trail that practitioners can use to monitor access and detect potential threats across GCP resources.
Prerequisites
Before you begin, verify that you have:
- The Microsoft Sentinel solution enabled.
- A defined Microsoft Sentinel workspace.
- A GCP environment collecting GCP audit logs.
- The Microsoft Sentinel Contributor role.
- Access to edit and create resources in the GCP project.
Set up GCP environment
You can set up the GCP environment in one of two ways:
- Create GCP resources via the Terraform API: Terraform provides an API for the Identity and Access Management (IAM) that creates the resources: The topic, a subscription for the topic, a workload identity pool, a workload identity provider, a service account, and a role.
- Set up GCP environment manually via the GCP console.
Create GCP resources via the Terraform API
Open GCP Cloud Shell.
Open the editor and type:
gcloud config set project {projectId}
In the next window, select Authorize.
Copy the Terraform GCPInitialAuthenticationSetup script, paste the script to a new file, and save it as a .tf file.
In the editor, type:
terraform init
Type:
terraform apply
Type your Microsoft tenant ID. Learn how to find your tenant ID.
When asked if a workload Identity Pool has already been created for Azure, type yes or no.
When asked if you want to create the resources listed, type yes.
Save the resources parameters for later use.
In a new folder, copy the Terraform GCPAuditLogsSetup script into a new file, and save it as a .tf file:
cd {foldername}
In the editor, type:
terraform init
Type:
terraform apply
To ingest logs from an entire organization using a single Pub/Sub, type:
terraform apply -var="organization-id= {organizationId} "
Type yes.
Save the resource parameters for later use.
Wait five minutes before moving to the next step.
Set up the GCP Pub/Sub connector in Microsoft Sentinel
- Open the Azure portal and navigate to the Microsoft Sentinel service.
- In the Content hub, in the search bar, type Google Cloud Platform Audit Logs.
- Install the Google Cloud Platform Audit Logs solution.
- Select Data connectors, and in the search bar, type GCP Pub/Sub Audit Logs.
- Select the GCP Pub/Sub Audit Logs (Preview) connector.
- Below the connector description, select Open connector page.
- In the Configuration area, select Add new.
- Type the resource parameters you created when you created the GCP resources. Make sure that the Data Collection Endpoint Name and the Data Collection Rule Name begin with Microsoft-Sentinel- and select Connect.
Verify that the GCP data is in the Microsoft Sentinel environment
To ensure that the GCP logs were successfully ingested into Microsoft Sentinel, run the following query 30 minutes after you finish to set up the connector.
GCPAuditLogs | take 10
Enable the health feature for data connectors.
Set up the GCP environment manually via the GCP portal
This section shows you how to set up the GCP environment manually. Alternatively, you can set up the environment via the Terraform API. If you already set up the environment via the API, skip this section.
Create the role
In the GCP console, navigate to IAM & Admin.
Select Roles and select Create role.
Fill in the relevant details and add permissions as needed.
Filter the permissions by the Pub/Sub Subscriber and Pub/Sub Viewer roles, and select pubsub.subscriptions.consume and pubsub.subscriptions.get permissions.
To confirm, select ADD.
To create the role, select Create.
Create the service account
- In the GCP Console, navigate to Service Accounts, and select Create Service Account.
- Fill in the relevant details and select Create and continue.
- Select the role you created previously, and select Done to create the service account.
Create the workload identity federation
In the GCP Console, navigate to Workload Identity Federation.
If it's your first time using this feature, select Get started. Otherwise, select Create pool.
Fill in the required details, and make sure that the Tenant ID and Tenant name is the TenantID without dashes.
Note
To find the tenant ID, in the Azure portal, navigate to All Services > Azure Active Directory > Overview and copy the TenantID.
Make sure that Enable pool is selected.
To add a provider to the pool:
Select OIDC
Type the Issuer (URL): \https://sts.windows.net/33e01921-4d64-4f8c-a055-5bdaffd5e33d
Next to Audiences, select Allowed audiences, and next to Audience 1, type: api://2041288c-b303-4ca0-9076-9612db3beeb2.
Configure the provider attributes
Under OIDC 1, select assertion.sub.
Select Continue and Save.
In the Workload Identity Pools main page, select the created pool.
Select Grant access, select the service account you created previously, and select All identities in the pool as the principals.
Confirm that the connected service account is displayed.
Create a topic
- In the GCP console, navigate to Topics.
- Create a new topic and select a Topic ID.
- Select Add default subscription and under Encryption, select Google-managed encryption key.
Create a sink
In the GCP console, navigate to Log Router.
Select Create sink and fill in the relevant details.
Under Sink destination, select Cloud Pub/Sub topic and select the topic you created previously.
If needed, filter the logs by selecting specific logs to include. Otherwise, all logs are sent.
Select Create sink.
Note
To ingest logs for the entire organization:
- Select the organization under Project.
- Repeat steps 2-4, and under Choose logs to include in the sink in the Log Router section, select Include logs ingested by this organization and all child resources.
Verify that GCP can receive incoming messages
- In the GCP console, navigate to Subscriptions.
- Select Messages, and select PULL to initiate a manual pull.
- Check the incoming messages.
Next steps
In this article, you learned how to ingest GCP data into Microsoft Sentinel using the GCP Pub/Sub Audit Logs connector. To learn more about Microsoft Sentinel, see the following articles:
- Learn how to get visibility into your data, and potential threats.
- Get started detecting threats with Microsoft Sentinel.
- Use workbooks to monitor your data.
Feedback
Submit and view feedback for