> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/health-sources/custom-health-metrics.md).

# Custom Health Source

Add and configure Custom Health Metrics or Custom Health Logs as a Continuous Verification health source

Harness supports major APM vendors and log providers, and Custom Health Source covers cases where you need a customized APM or log provider. This topic describes how to add and configure Custom Health as a health source for the AI Verify (v1) step.

***

## What you will learn from this topic

* How to [add a custom health source](#add-a-custom-health-source) and select Metrics or Logs
* How to map [Custom Health Metrics](#custom-health-metrics), including query type, JSON paths, and risk assignment
* How to map [Custom Health Logs](#custom-health-logs), including path, body, and JSON path selection

***

## Before you begin

* **Continuous Verification setup:** Complete the shared AI Verify (v1) step and health source prerequisites first. Go to [Configure Continuous Verification](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/verify-deployments.md) to configure CV.
* **Fixed service and environment:** Adding a Custom Health Source is available only when the service and environment are configured as fixed values.
* **Connector:** You need a connector that can reach your custom metrics or logs endpoint.

***

## Add a custom health source

A health source maps a Harness service to the service in a deployment environment that an APM or logging tool monitors.

In **Health Sources**, click **Add**. The **Add New Health Source** settings appear.

![Add New Health Source dialog with Custom Health selected](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-bbdf38a62813f8ceaf64c2f3de570ab31aa7f838%2Fverify-deployments-with-custom-health-metrics-90.png?alt=media)

Perform the following steps to add the health source:

1. In **Select health source type**, select **Custom Health**.
2. In **Health Source Name**, enter a name for the health source. For example, `Quickstart`.
3. In **Connect Health Source**, click **Select Connector**.
4. In **Connector** settings, choose an existing connector or click **New Connector**.
5. Click **Apply Selected**. The connector is added to the health source.
6. In **Select Feature**, select the feature to monitor: **Custom Health Metrics** or **Custom Health Logs**.
7. Click **Next**.

***

## Custom Health Metrics

If you select **Custom Health Metrics**, the **Customize Health Source** settings appear.

![Customize Health Source settings for Custom Health Metrics](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-d21a75fa302999b800c274eb10ec6d8d94e0fbe3%2Fverify-deployments-with-custom-health-metrics-91.png?alt=media)

Perform the following steps to map metrics:

1. Click **Map Metric(s) to Harness Services**.
2. In **Metric Name**, enter the name of the metric.
3. In **Group Name**, click **Add New** and enter a name for the metric group.
4. Click **Query specifications and mapping**.
5. In **Query Type**, choose either **Service Based (used for Health Score and SLI)** or **Host Based (used for CV)**. If you select **Host Based** (Continuous Verification), verification does not run for SLI and Health Score (Service Based), and the reverse is also true.
6. In **Request Method**, select **GET** or **POST**. If you select **POST**, define the body format.
7. In **Path**, enter the complete path of the metric.
8. In **Start and End Time Placeholders**, configure the following fields:
   1. In **Start time placeholder**, enter the start time placeholder in the metric path.
   2. In **Unit**, select the preferred unit of measurement.
   3. In **End time placeholder**, enter the end time placeholder in the metric path.
   4. In **Unit**, select the preferred unit of measurement.
9. Click **Fetch Records** to retrieve records from the provided URL.
10. Click **Metric values and charts**. For each path, click the **+** icon to select the appropriate path from the data source.
    1. For **Metric Value Json Path**, provide a JSON path with at least two `*` segments.
    2. For **Timestamp Value Json Path**, provide a JSON path with at least two `*` segments.
    3. For **Service Instance Identifier Json Path**, provide a JSON path with at least one `*` segment.
    4. In **Timestamp Format**, enter a static value in `dd/mm/yy` format.
11. Click **Assign**. Select the services for which you want to apply the metric. You can select **Health Score**, **SLI**, or both. The next fields depend on the services you select.
12. In **Risk Category**, select a risk type. Available options are:
    * Errors
    * Infrastructure
    * Performance/Throughput
    * Performance/Other
    * Performance/Response Time
13. In **Deviation compared to Baseline**, select one of the following options based on the selected risk type:
    * **Higher value is higher risk:** Select this option if a higher value of the selected risk type is a risk.
    * **Lower value is higher risk:** Select this option if a lower value of the selected risk type is a risk.
14. Click **Submit**.

***

## Custom Health Logs

If you select **Custom Health Logs**, the **Customize Health Source** settings appear.

![Customize Health Source settings for Custom Health Logs](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-3603078204c936aea1ac857132cdf064bb0c0815%2Fverify-deployments-with-custom-health-metrics-92.png?alt=media)

Perform the following steps to map logs:

1. Click **Query specifications and mapping**.
2. In **Query Name**, enter a name for the query. For example, `Custom Log Query`.
3. In **Request Method**, select **GET** or **POST**. If you select **POST**, define the body format.
4. In **Path**, enter the complete path of the metric. For example, `v2/logs/events/search`.
5. In **Start and End Time Placeholders**, configure the following fields:
   1. In **Start time placeholder**, enter the start time placeholder in the metric path. For example, `start_time`.
   2. In **Unit**, select the preferred unit of measurement. For example, Milliseconds.
   3. In **End time placeholder**, enter the end time placeholder in the metric path. For example, `end_time`.
   4. In **Unit**, select the preferred unit of measurement. For example, Milliseconds.
6. In **Body**, enter the request body. For example, `{"filter":{"query":","from":start_time,"to":end_time}}`.
7. Click **Fetch Records** to retrieve records from the provided URL.

![Fetch Records response for a Custom Health Logs query](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-f9fb266cd9aea98b243913100738b432d7e856f0%2Fverify-deployments-with-custom-health-metrics-93.png?alt=media)

8. After the response is retrieved, click **JSON path selection**.
   1. In **Log Message JSON path**, click the plus icon to select the path to the log message from the data source. For example, `$.data.[*].attributes.message`.
   2. In **Timestamp Field/Locator JSON Path**, click the plus icon to select the path to the timestamp from the data source. For example, `$.data.[*].attributes.timestamp`.
   3. In **Provide Service Instance to map to Harness Service Instance**, click the plus icon to select the service instance from the data source. For example, `$.data.[*].attributes.tags.[4]`.

![JSON path selection for log message, timestamp, and service instance](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-ffffffdc177c1c7f889bb1fcb4b924e8163feec6%2Fverify-deployments-with-custom-health-metrics-94.png?alt=media)

9. Click **Submit**.

***

## Next steps

* [Configure Continuous Verification](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/verify-deployments.md): Finish AI Verify (v1) step settings and run verification.
* [CloudWatch Logs](/continuous-delivery/use-continuous-delivery/verify-deployments/configure-cv/health-sources/cloudwatch-aws.md): Use CloudWatch Logs as a health source when you do not need a custom provider.
* [Interpret log results](/continuous-delivery/use-continuous-delivery/verify-deployments/cv-results/interpret-log-results.md): Review how Harness presents log-based verification results.

{% @harness-feedback/feedback %}
