# Splunk Search API

### Description

The Splunk Search API source uses the [Splunk Search API](https://docs.splunk.com/Documentation/Splunk/9.3.1/RESTREF/RESTsearch) to collect past events.

### Supported Platforms

| Platform | Metrics | Logs | Traces |
| -------- | ------- | ---- | ------ |
| Linux    |         | ✓    |        |
| Windows  |         | ✓    |        |
| macOS    |         | ✓    |        |

### Prerequisites

* Splunk admin credentials

### Use Case

Unlike other sources, the SSAPI source is not built to stream live data. Instead, it collects a finite set of event data and transfers it to a destination, preserving the timestamp from the original Splunk event.

**Note**: Once the source has started collecting events for a search, allow it to complete unless it is absolutely necessary to stop progress. If a search must be interrupted, run that search again to pick up where progress was interrupted. If you switch to a different search instead, the checkpoint for the search will be wiped from storage.

### Configuration Table

<table><thead><tr><th width="158.5859375">Parameter</th><th width="116.26953125">Type</th><th width="310.20703125">Default</th><th width="235.40625">Description</th></tr></thead><tbody><tr><td>hostname</td><td><code>string</code></td><td></td><td>Splunk search head hostname.</td></tr><tr><td>port</td><td><code>string</code></td><td>8089</td><td>Splunk instance endpoint port.</td></tr><tr><td>auth_mode</td><td><code>enum</code></td><td>"basic"</td><td>Authentication mode to use when connecting to the Splunk REST API. Valid values are "basic" and "token".</td></tr><tr><td>username</td><td><code>string</code></td><td></td><td>Username used to authenticate to the Splunk REST API.</td></tr><tr><td>password</td><td><code>string</code></td><td></td><td>Password used to authenticate to the Splunk REST API.</td></tr><tr><td>auth_token</td><td><code>string</code></td><td></td><td>Auth token used to authenticate to the Splunk REST API.</td></tr><tr><td>token_type</td><td><code>enum</code></td><td></td><td>Type of token used to authenticate to the Splunk REST API. Valid values are "Bearer" and "Splunk".</td></tr><tr><td>job_poll_interval</td><td><code>int</code></td><td>5</td><td>How many seconds to wait between polling for search job completion.</td></tr><tr><td>searches.query</td><td><code>string</code></td><td></td><td>Splunk search to run to retrieve the desired events. Queries must start with search and should not contain additional commands, nor any time fields (e.g. earliesttime).</td></tr><tr><td>searches.earliest_time</td><td><code>string</code></td><td></td><td>Earliest timestamp to collect logs (inclusive).</td></tr><tr><td>searches.latest_time</td><td><code>string</code></td><td></td><td>Latest timestamp to collect logs (inclusive).</td></tr><tr><td>searches.event_batch_size</td><td><code>int</code></td><td>100</td><td>Amount of events to query from Splunk for a single request.</td></tr><tr><td>enable_tls</td><td><code>bool</code></td><td>true</td><td>Whether or not to use TLS.</td></tr><tr><td>tls_certificate_path</td><td><code>string</code></td><td></td><td>Path to the TLS cert to use for TLS-required connections.</td></tr><tr><td>tls_private_key_path</td><td><code>string</code></td><td></td><td>Path to the TLS key to use for TLS-required connections.</td></tr><tr><td>enable_storage</td><td><code>bool</code></td><td>true</td><td>Whether or not to use a storage extension. Should be enabled in all environments.</td></tr><tr><td>storage_directory</td><td><code>string</code></td><td><code>$OIQ_OTEL_COLLECTOR_HOME/storage</code></td><td>The directory where the storage file will be created.</td></tr></tbody></table>

### Configuration Instructions

1. Identify the Splunk index to migrate events from. Create a Splunk search to capture the events from that index. This will be the query you pass to the source.

* Example: `search index=my_index`
* Note: queries must begin with the explicit `search` command, and must not include additional commands, nor any time fields (e.g. earliesttime)

2. Determine the timeframe you want to migrate events from, and set the ‘Earliest Time’ and ‘Latest Time’ config fields accordingly.

* To migrate events from December 2024, EST (UTC-5):
  * Earliest Time: "2024-12-01T05:00"
  * Latest Time: "2025-01-01T04:59”
* Note: By default, GCL will not accept logs with a timestamp older than 30 days. Contact Google to modify this rule.

3. Repeat steps 1 & 2 for each index you wish to collect from

* This is not a requirement. The receiver can migrate multiple searches at once, but doing one at a time will allow for easier testing and debugging of the source.

4. Configure the rest of the source fields according to your Splunk environment.

<figure><img src="https://1405008107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgmiOMzBfoNFwmKJFHMcJ%2Fuploads%2Fgit-blob-b375d46e75f361d623ef2a829696ba8ed04b104b%2Fintegrations-sources-splunk-search-api-image-1.png?alt=media" alt="Bindplane docs - Splunk Search API - image 1"><figcaption></figcaption></figure>

<figure><img src="https://1405008107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgmiOMzBfoNFwmKJFHMcJ%2Fuploads%2Fgit-blob-ce9b0d5a0bf1fb655712b4e50257709f3c888696%2Fintegrations-sources-splunk-search-api-image-2.png?alt=media" alt="Bindplane docs - Splunk Search API - image 2"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bindplane.com/integrations/sources/splunk-search-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
