In Harness, a Health Source is a mapping that connects a Service in Harness to a service running in a deployment environment that is being monitored by an Application Performance Monitoring (APM) or logging tool. This mapping allows Harness to collect metrics and data from the APM or logging tool and use it to determine the health and status of the Service in Harness.
This topic describes how to set up Elasticsearch as a health source in a monitored service.
- Elasticsearch connector has been added to the Harness platform.
- A monitored service has already been created in the Harness SRM.
Add Elasticsearch health source
To add Elasticsearch as a health source:
In your Harness project, go to Service Reliability > Monitored Services.
A list of monitored services is displayed.
Locate the monitored service for which you want to add a custom change source, select the three vertical dots next to it, and then select Edit service.
The Configurations page appears.
Go to the Service tab, and under Define Your Sources, select + Add New Health Source.
On the Define Health Source tab, do the following:
In the Define Health Source section, select ElasticSearch as health source type.
In the Health Source Name field, enter a name for the health source.
In the Connect Health Source section, choose Select Connector.
The Create or Select an Existing Connector dialog appears.
Select a connector for the Elasticsearch health source and then select Apply Selected.
The selected connector appears in the Select Connector dropdown.
The Configuration tab appears.
Currently, Harness supports only Elasticsearch logs. The ElasticSearch Logs option is selected by default in the Select Feature field.
Define log configuration settings
On the Configuration tab, select + Add Query.
The Add Query dialog appears.
Enter a name for the query and then select Submit.
The query that you added gets listed under the Logs Group. The Custom Queries settings are displayed. These settings help you retrieve the desired logs from the Elasticsearch platform and map them to the Harness service.
Define a query
In the Query Specifications and Mapping section, select a log index from the Log Indexes list.
In the Query field, enter a log query and select Run Query to execute it.
A sample record in the Records field. This helps you confirm the accuracy of the query you've constructed.
In the Field Mapping section, map the following identifiers to select the data that you want to be displayed from the logs.
- Timestamp Identifier
- Service Instance Identifier
- Message Identifier
- Timestamp Format
To define mapping, in each identifier field, do the following:
The Select path for Service Instance Identifier page appears.
Go to the identifier value that you want to map and choose Select.
The selected value gets mapped to the corresponding identifier field.
Select Get sample log messages.
Sample logs are displayed that help you verify if the query you built is correct.
Save the health source settings
- After configuring all the settings, select Submit. The Elasticsearch health source gets added to the monitored service.