> 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/harness-ai/use-harness-platform/connectors/monitoring-and-logging-systems/add-a-splunk-connector.md).

# Add a Splunk connector

Add a Splunk connector so Harness can fetch logs from your Splunk deployment for verification.

Splunk is a data platform that collects, indexes, and searches machine data such as application logs and events, available as Splunk Enterprise (self-hosted) and Splunk Cloud Platform. Add a Splunk connector in Harness to let your pipelines run searches against your Splunk logs. Harness can then use that data in Continuous Verification to compare log patterns and detect anomalies after a deployment, helping you confirm a release is healthy or trigger a rollback.

Go to [Overview](https://developer.harness.io/harness-ai/use-harness-platform/connectors/monitoring-and-logging-systems/monitoring-and-logging-systems-connectors-overview.md) for information about all monitoring and logging connectors, such as scopes and delegate selection.

***

## What you will learn from this topic

* How to configure the [role capabilities](#splunk-account-permissions) that the Splunk account needs.
* How to [add a Splunk connector](#add-a-splunk-connector) to a Harness project.
* How to configure the [credentials](#credentials) for Splunk and choose the [delegates](#delegates-setup) that verify the connection.

***

## Before you begin

* **Splunk REST API access**: A non-SAML Splunk account with access to the REST API on the Splunk server.
* **Harness permissions**: Permission to create connectors and secrets in Harness.

***

## Splunk account permissions

Splunk APIs require you to authenticate with a non-SAML account. To access your Splunk Cloud deployment using the Splunk REST API and SDKs, submit a support case requesting access on the Splunk Support Portal.

* **Managed deployments**: Splunk Support opens port 8089 for REST access. You can specify a range of IP addresses for controlled access to the REST API.
* **Self-service deployments**: Splunk Support defines a dedicated user and sends you credentials that enable that user to access the REST API.

Go to [Using the REST API with Splunk Cloud](http://docs.splunk.com/Documentation/Splunk/7.2.0/RESTTUT/RESTandCloud) in the Splunk documentation for details.

The Splunk user account that authenticates Harness must belong to a role with the following capabilities:

* **Search**: Permission to run searches.
* **Index access**: Access to the indexes you want to search.

The following example shows a Splunk role named **Harness User** that has the search capability.

![Splunk role with search capability](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-14ba7488c9e1ed192494b9ccbbf288c0fae0b04e%2Fconnect-to-monitoring-and-logging-systems-22.png?alt=media)

The example role has access to **All non-internal indexes**. You can restrict the role to only the relevant indexes.

![Splunk role index access settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-34834d1817adddae7943e485ed56296e8505734d%2Fconnect-to-monitoring-and-logging-systems-23.png?alt=media)

***

## Add a Splunk connector

You can add a Splunk connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account scope.

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **Splunk** under **Monitoring and Logging Systems**. The Splunk connector settings appear.

### Overview

Configure the identity fields for the connector.

1. In **Name**, enter a name for the connector. Harness generates the **Id** from the name.
2. Optionally, add a **Description** and **Tags**.
3. Click **Continue**.

![Splunk connector overview settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-309a20f18c816d888bbdc8bd424d42e64835ddfe%2Fsplunk-connector-overview.png?alt=media)

### Credentials

Configure the following settings:

1. In **URL**, enter the URL to access the REST API on the Splunk server, including the port number. The default port is 8089. For example, `https://deployment-name.cloud.splunk.com:8089` or `https://mycompany.splunkcloud.com:8089`.
2. In **Authentication**, select one of the following options:
   * **Username and Password**:
     * In **Username**, enter the username of your Splunk account.
     * In **Password**, select or create a [Harness encrypted text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md) to store your password.
   * **Bearer Token (HTTP Header)**: A **bearer token** is an authentication token you send in the HTTP `Authorization` header, instead of a username and password, when calling the REST API. Select or create a [Harness encrypted text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md) to store the authentication token.
   * **No Authentication**: Connect without credentials. Use this option only when your Splunk server does not require authentication.
   * **HEC Authentication**: An **HEC token** is the credential for Splunk’s HTTP Event Collector (HEC). HEC lets you send data and application events to a Splunk deployment over HTTP or HTTPS. Select or create a [Harness encrypted text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md) to store the HEC token.
3. Click **Connect and Save**.

![Splunk connector credentials with the URL, authentication, username, and password fields](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-cdfb88a77415f6ece30dd86bdda69ead1121568e%2Fsplunk-connector-credentials.png?alt=media)

{% hint style="warning" %}
**HEC authentication does not support data fetching**

The HEC authentication method works only for data ingestion. To fetch data, use username and password authentication. If you use HEC authentication, you cannot use Harness Continuous Verification, because it relies on data fetching.
{% endhint %}

### Delegates Setup

Select one of the following options:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Enter the tags of the delegates Harness must use with this connector.

The **Test Delegate Connectivity** list shows the delegates that match your selection. To add a delegate, click **Install new Delegate**.

Click **Save and Continue**.

![Splunk connector delegates setup with the delegate connectivity list](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-ba26a8bee303de5a39341d94c59bebbe005c08fe%2Fsplunk-connector-delegates-setup.png?alt=media)

### Verify Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors** page.

***

## Sample YAML

The following example shows a YAML for the Splunk connector created in this topic.

<details>

<summary>YAML - Splunk connector</summary>

```yaml
connector:
  name: your-splunk-connector # Replace with a name for your connector
  identifier: yoursplunkconnector # Replace with a unique identifier
  description: ""
  accountIdentifier: youraccountidentifier # Replace with your Harness account identifier
  orgIdentifier: default # Replace with your organization identifier, or remove for account scope
  projectIdentifier: yourprojectidentifier # Replace with your project identifier, or remove for org/account scope
  type: Splunk
  spec:
    splunkUrl: https://splunk.example.com:8089/ # Replace with the URL of the Splunk REST API, including the port
    username: your-splunk-username # Replace with your Splunk username
    accountId: youraccountidentifier # Replace with your Harness account identifier
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
    passwordRef: your-password-secret # Replace with a reference to the Harness secret storing your password
    type: UsernamePassword # Authentication type for Username and Password
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](https://developer.harness.io/harness-ai/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](https://developer.harness.io/harness-ai/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): Control which delegates can connect to this connector.
* [Add a text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md): Store the Splunk password as a Harness secret.
