Getting Data In

How to Access Splunk's REST API

_gkollias
SplunkTrust
SplunkTrust

I'm working on sending requests to Splunk's REST API for the first time and have a few questions after reading through the tutorial/manual:

  1. I can't locate the /services/ directory under /splunk/home/. Is this created out of the box, or something we need to add in /etc/apps?

  2. Our dev environment is currently http - will sending requests to http://localhost:8080/... be sufficient for testing?

Any insight is greatly appreciated.

Thanks!

0 Karma

Damien_Dallimor
Ultra Champion

There are numerous examples (using CURL) of using the Splunk REST API in the reference manual.

Via your browser you could also browse to https://localhost:8089/services

Furthermore , we have many language SDK's that make it easier to programmatically interact with the Splunk REST API.

0 Karma

_gkollias
SplunkTrust
SplunkTrust

Thanks, Damien

Again the example you've posted goes back to using https with port 8089. Our dev environment is currently http - would that make a difference? Here is what I see when I use http://localhost:8080

The path '/en-US/services' was not found.

What should I see here?

0 Karma

Damien_Dallimor
Ultra Champion

8089 is splunk's default management port and the port you access the Rest Api at over https.

Perhaps you are confusing yourself with the Splunk Web port which is by default 8000 and accessed over http.This is not Splunk's Rest Api endpoint.

Please follow and try the advice in my prior post.

0 Karma

richgalloway
SplunkTrust
SplunkTrust
  1. You don't need to create anything for the REST API to work.
  2. That should work just fine.
---
If this reply helps you, Karma would be appreciated.

_gkollias
SplunkTrust
SplunkTrust

Awesome - maybe I'm over-thinking this one. So it's really as simple as if there is no /services/ directory just point it to wherever the saved search is IE http://localhost:8080/en-US/apps/search/saved/searches?

0 Karma

richgalloway
SplunkTrust
SplunkTrust

You're still over-thinking it. 🙂 There is no services directory, but you must still include it in your query. Follow the manual and you should do fine.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...