This guide will assist you with the creation of the Google Cloud Platform Data Input within Loom. There are two main sections in this article to provide a comprehensive configuration guide: Prerequisites and Data Input Configuration Within Loom.
We need to configure a service account within your GCP project in order to stream logs to Sophie.
GCP Service Account with Subscriber IAM Role Creation
Step 1: Create a GCP Service Account with Proper Permissions
From within the GCP console select the project where your services are located and then navigate to IAM & admin > Service Accounts.
Step 2: Select create service account.
Follow the prompts to name the service account that Loom will use and then select Create.
In the next screen GCP will ask us to assign an IAM role to the service account. Select the Pub/Sub > PubSub Subscriber role.
In the final screen we will create the service account key. Make sure to select JSON format and a file with the private key will be downloaded to your machine. Save this private key file as we will use it later in the Data Input configuration. Also, take note of the new Key ID populated in the Keys section.
This completes the service account creation prerequisite.
Data Input Configuration Within Loom
To start, login to your Loom console and navigate to Settings > Add & Manage Data > Data Inputs > Plug a New Data Input. From the selection screen search for ‘PubSub’ and select GCE PubSub.
This will take us to the configuration screen where we need to input our GCP service account and subscription information generated in the Prerequisites section of this guide.
Provide a unique name to your GCP Data Input within Loom and input the project ID which contains the Topic(s) we want to subscribe to.
The Project ID can be found on the Home > Dashboard screen within GCP on the Project info card as shown below.
Next, we need to specify the GCP Topic we want Loom to subscribe to. This can be found within Pub/Sub.
In this case the Topic field within Loom would contain MyLoomTopic.
To fill in the Private Key, Private Key ID, Client Email, and Client ID fields we will have to revisit the IAM & Admin > Service Account section of the GCP console.
The Private Key corresponds to the JSON private key that was downloaded onto your local machine after generating the Key for the service account at the end of Step 1 of the Prerequisites section. To extract the private key from this json file open the file in a text editor of your choice. Find the “private_key” section of the file. Here we want the entire string between “-----BEGIN PRIVATE KEY-----” and “-----END PRIVATE KEY-----”.
As seen above the private key may contain new line characters “\n”. It is important to remove these, so in a text editor select the find operation and replace all instances of “\n” with nothing so that only the private key characters remain. After this removal we can now copy the private key into the Private Key field within loom.
Within the Service Account section of GCP the Email field corresponds to Client Email within Loom.
The Key ID field within GCP corresponds to the Private Key ID within Loom, and the Unique ID within GCP corresponds to the Client ID within Loom.
Lastly, populate the subscription name found in Pub/Sub for the Topic entered earlier.
In the case below the Subscription Name would be MyLoomSub.
That is all; the configuration process is complete. Now, select Test & Save at the bottom of the Data Input screen to start streaming your data from your Google Cloud Platform project.