Grafana Loki
Add Grafana Loki as a health source in Harness CV to monitor log data and detect anomalies during deployments.
This topic explains how to add Grafana Loki as a health source for Continuous Verification (CV). Once configured, Harness queries your Loki instance for log data during deployment verification and flags anomalies that could indicate a degraded release.
What you will learn from this topic
Grafana Loki connector setup: How to create and configure a Grafana Loki connector, including the base URL, headers, and validation path.
Health source configuration: How to add Grafana Loki as a health source in the AI Verify (v1) step.
Log query definition: How to write a Loki log query and run it to confirm accuracy.
Field mapping: How to map query results to Harness service instances for accurate verification.
Before you begin
Before you add Grafana Loki as a health source, complete the following:
CV setup: Set up an AI Verify (v1) step in your pipeline. Go to Configure CV to complete the prerequisite configuration.
Grafana Loki instance: You need a running Grafana Loki instance. By default, Loki exposes its API on port 3100 without authentication.
Connector permissions: You need permission to create connectors in your Harness project.
Add Grafana Loki as a health source
The following steps walk you through adding Grafana Loki as a health source in the AI Verify (v1) step.
Define the health source
To configure the health source connection, do the following:
In the Health Sources section of the Verify screen, select + Add New Health Source.
The Add New Health Source dialog appears.
In the Define Health Source tab, do the following:
In the Define Health Source section, select GrafanaLoki as the health source type.
In the Health Source Name field, enter a name for the health source.
In the Connect Health Source section, select Select Connector.
The Create or Select an Existing Connector dialog appears.
Select a connector for the Grafana Loki health source, then select Apply Selected.
The selected connector appears in the Select Connector dropdown. The Grafana Loki Logs option is selected by default in the Select Feature field.
Select Next. The Configuration tab appears.
Define log configuration settings
In the Configuration tab, do the following to add and name a query:
Select + Add Query.
The Add Query dialog appears.
Enter a name for the query, then select Submit.
The query is listed under Logs Group. The query specification and mapping settings appear. These settings help you retrieve the desired logs from the Grafana Loki platform and map them to the Harness service.
Define a query
After naming the query, configure the log query and field mappings:
In the Query field, enter a log query and select Run Query to execute it.
A sample record appears in the Records field. This helps you confirm the accuracy of the query you constructed.
In the Field Mapping section, select + to map the service instance identifiers and select the data you want displayed from the logs. Go to Service Instance Identifier (SII) to understand how Harness uses this mapping.
Select Get sample log messages.
Sample logs appear to help you verify that the query is correct.
Next steps
After adding Grafana Loki as a health source, run your pipeline to start collecting log data during deployment verification.
Configure CV: Review the full CV configuration workflow to ensure all components are set up correctly.
Verify deployments with the Verify step: Understand how the AI Verify (v1) step evaluates health sources during a deployment.
Service Instance Identifier: Learn how Harness uses service instance identifiers to correlate log data with deployment instances.
Last updated
Was this helpful?
