Google Cloud Platform is the basis for creating, enabling, and using all Google Cloud services including managing APIs, enabling billing, adding and removing collaborators, and managing permissions for Google Cloud resources.
Prerequisite
- Create a google account
- Set up a Cloud Console project
Create a Project
- Go to the Manage resources page in the Cloud Console.
- On the Select organization drop-down list at the top of the page, select the organization in which you want to create a project. If you are a free trial user, skip this step, as this list does not appear.
- Click Create Project.
- In the New Project window that appears, enter a project name and select a billing account as applicable. A project name can contain only letters, numbers, single quotes, hyphens, spaces, or exclamation points, and must be between 4 and 30 characters.
- Enter the parent organization or folder in the Location box. That resource will be the hierarchical parent of the new project.
- When you're finished entering new project details, click Create.
Create a topic
- Go to the Pub/Sub topics page in the Cloud Console.
- Click Create a topic.
In the Topic ID field, provide a unique topic name, for example, MyTopic. - Click Save.
That's it—you've just created a Pub/Sub topic!
Create a subscription on the previously created topic.Here
Add a subscription
To add a subscription to the topic you just created:
-
Display the menu for the topic you just created, and click New subscription.
-
Type a name for the subscription, such as MySub.
-
Leave the delivery type as Pull.
-
Click Create
Publish a message to the topic
To publish a message to the topic:
- Go to the Topic details page for the topic you just created.
- Click the Messages tab near the bottom of the page, then click Publish Message.
- Enter a message in the Message field.
- Click Publish.
Create key from service account
- In the Cloud Console, go to the Service Accounts page.
- Select a project.
- Click the email address of the service account that you want to create a key for.
- Click the Keys tab.
- Click the Add key drop-down menu, then select Create new key.
- Select JSON as the Key type and click Create.
Clicking Create downloads a service account key file. After you download the key file, you cannot download it again.
The downloaded key has the following format, where private-key is the private portion of the public/private key pair:
Pull message from subscriptionOR Use Connector
Pull message
- In the Cloud Console, go to the Pub/Sub subscriptions page.
- Click the subscription ID.
- In the Subscription details page, click View messages.
- Click Pull.
Connector
The following are the configurations to forward GCP PUB/SUB logs to DNIF.
Configuration | Description |
Connector Name | Enter a name for the connector |
Connector Type | Enter a type for the connector |
Project Id | Enter the project name |
Subscription Id: | Enter the Subscription Id of the topic you created |
Credentials File | Enter the details from credentials.json file, downloaded while creating the project |
Number of Processes | Total number of processes that can be run at a time |
- Click Save after entering all the required details and click Test Connection, to test the configuration.
- A Connection successful message will be displayed on screen along with the time stamp.
- If the connection is not successful an error message will be displayed. Refer Troubleshooting Connector Validations for more details on the error message.
Once the connector is configured, validate if the connector is listed under Collection Status screen with status as Active. This signifies the connector is configured successfully and data is ready to ingest.