Verify Deployments with Stackdriver Logging
Harness can analyze Stackdriver data and analysis to verify, rollback, and improve deployments. To apply this analysis to your deployments, you set up Stackdriver as a verification step in a Harness Workflow.
This topic covers how to set up Stackdriver Logs in a Harness Workflow, and provides a summary of Harness verification results.
In order to obtain the names of the host(s), pod(s), or container(s) where your service is deployed, the verification provider should be added to your workflow after you have run at least one successful deployment.
Before You Begin
- Set up a Harness Application, containing a Service and Environment. See Create an Application.
- See the Stackdriver Verification Overview.
Visual Summary
Here's an example of a completed Stackdriver setup for verification.
Step 1: Set up the Deployment Verification
To verify your deployment with Stackdriver, do the following:
-
Ensure that you have added Google Cloud Platform as a Cloud Provider provider, as described in Connect to Stackdriver.
-
In your Workflow, under Verify Service, click Add Step.
-
In the resulting Add Step settings, select Log Analysis > Stackdriver.
-
Click Next. The Configure****Stackdriver settings appear.
-
In GCP Cloud Provider, select the Google Cloud Platform (GCP) Cloud Provider you set up in Harness.
You can also enter variable expressions, such as:${serviceVariable.stackdriver_connector_name}
.If the GCP Cloud Provider field contains an expression, the Region field must also use an expression.1. In Region, select the GCP region where the application is hosted. The Stackdriver API uses a service-specific notion of location. Harness uses the name of a region. You can find the region in Stackdriver Metrics Explorer by selecting the location column:
You can also enter a variable expression for the region, such as
${env.name}
.Because Harness does not currently support multi-region load balancers, you must add a Stackdriver step for each region. If the GCP Cloud Provider field contains an expression, the Region field must also use an expression. -
Select Log Verification.
Step 2: Search Keywords
Enter search keywords for your query. You can use the same filters you have in GCP Logs Viewer.
Simply copy a filer entry into Search Keywords:
To use multiple filter entries, you can place an AND between them or use multiline entries. For example:
For advanced filter examples, see Advanced filters library from GCP.