Skip to main content
Sumo Logic

Google Cloud Platform Source

You can export in real time all of the data collected by Stackdriver to Google Cloud Pub/Sub. Sumo Logic uses the  Pub/Sub integration to push logs to our platform in real time.

If you are using Google Cloud Platform (GCP) services, all log data for these services is collected and exposed through the Google Cloud Stackdriver service. You can export in real time all of the data collected by Stackdriver to Google Cloud Pub/Sub. We use this Pub/Sub integration to push logs to our platform in real time.

To get started collecting data from Google Cloud Platform, you must:

  • Configure an HTTP Source in Sumo Logic.
  • Ensure that GCP logs data are exported to Stackdriver.
  • Configure a Google Pub/Sub topic, and export GCP Stackdriver logs to Google Pub/Sub.
  • Configure a Google Pub/Sub Push subscription to send data to your Sumo HTTP Source. As part of this process, you will need to use Google’s Webmaster Console to validate that you are the owner of the Sumo Logic API endpoint.

Before you can configure a Pub/Sub push subscription to send data to an external URL, you must validate that you own that URL. The instructions below help you validate that you ‘own’ the URL provided to you when you created the Sumo HTTP Source.

To collect logs from GCP:

  1. Create an HTTP Source.
    1. Add the HTTP source URL as an allowed domain to your GCP account.  This source will be a Google Pub/Sub-only source, which means that it will only be usable for log data formatted as data coming from Google Pub/Sub.
  2. Add the HTTP source URL as an allowed domain to your GCP account.
    1. Open your Google Cloud Console.
    2. Select Products and services > API Manager > Credentials.
      Credentials
    3. Select Domain Verification > Add Domain.
      API Manager
    4. In the Configure webhook notifications for … dialog,  add the HTTP source URL as valid domain and click Add Domain.

      DomainVerification
    5. Click Take Me There to verify ownership of the URL at Google’s webmaster central page. You are taken to the Google’s Webmaster Central interface to verify the URL.  
      Verify
    6. Click Add Property in the Webmaster Central site and add the HTTP Source URL.

      WebmasterCentral
  3. Update the HTTP Source configuration, using the Sumo Logic Collector Management API, with information from the HTML verification file that you just downloaded from Webmaster central.  Add a thirdPartyRef field in the HTTP Source JSON file and insert the HTML verification file.
    1. Review the Collector Management API.

    2. Have an Access Key and ID. Save them because you will need them later.

    3. Click on the information icon for the source to get the source API URL.
      InformationIcon

    4. Copy the Source API URL field.

    5. Using the Source API URL, make a GET request that looks like this:
      curl -v -u "accessid:accesskey" -X GET https://yourendpoint/api/v1/collectors/collectorID/sources/sourceID >source.json

      You will see a response containing your etag:

      Response with etag

    6. Make note of the etag value in the response. You will need it.

    7. Edit JSON file to insert the thirdPartyRef JSON block below, replacing the ’name’ field with the filename of the google HTML Verification File, and the ‘contents’ field with the full string from the body of the HTML Verification File.

    8. Update the HTTP source with the new thirdPartyRef field and fill in the Google verification information

      {
       "source":{
         "id":102208531,
         "name":"test-http-source",
         "category":"test-category",
         "hostName":"test-hostname",
         "automaticDateParsing":true,
         "multilineProcessingEnabled":true,
         "useAutolineMatching":true,
         "forceTimeZone":false,
         "thirdPartyRef":{
           "resources":[
             {
               "serviceType": "GoogleCloudLogs",
               "path":{
                 "type":"NoPathExpression"
               },
               "authentication": {
                 "type": "GoogleCloudAuthentication",
                 "validations": [
                   {
                     "type":"GoogleCloudValidationDoc",
                     "name":"google-validation-html-filename",
                     "content": "google-validation-html-file-content"
                   }
                 ]
               }
             }
           ]
         },
         "timeZone":"Etc/UTC",
         "filters":[],
         "cutoffRelativeTime":"-1d",
         "encoding":"UTF-8",
         "messagePerRequest":false,
         "sourceType":"HTTP",
         "alive":true
       }
      }

  4. Update the Source JSON file using the API with the following CURL command. You must add the etag value in the example below.
    curl -u "accessid:accesskey" -X PUT -H "Content-Type: application/json" -H "If-Match: \"etag\"" -T source.json https://api.sumologic.com/api/v1/collectors/collectorID/sources/sourceID
  5. After the JSON file is uploaded, return to the Google, and click Verify on the page in point number 2. It should verify successfully.
  6. Create a Google Pub-Sub topic.  
  7. Add HTTP source URL to the Google Pub/Sub topic.
    1. Go to the Pub/Sub topic.
    2. Create Subscription > Add the HTTP source URL and subscription name.
      topicdetails
  8. Integration can be tested by going to the Pub/Sub topic > Publish Message > Type a message > Publish
    The log message will be in JSON format with a field called “data” having your typed message as the value.

You’re done. To configure Stackdriver to export logs to Sumo, follow the Google Cloud Instructions.