Splunk Search

splunk restful service not working

kml_uvce
Builder

I am trying to get restful service from splunk

curl -k -u username:password -k https:///services/search/jobs -d search="index=neteng|head 5"

I am getting this error.
<?xml version='1.0' encoding='UTF-8'?>
Search operation 'index' is unknown. You might not have permission to run this operation.

But I have the permission to run/view in web splunk.

kamal singh bisht
Tags (2)
0 Karma

Ayn
Legend

You need to specify the "search" command at the start of the search parameter. When you run searches in the web UI, the search command is implicitly added at the start, however when interacting directly with the REST API it is not.

So, the modification needed to make this work should be:

curl -k -u <username:password> -k https://<splunk server="">/services/search/jobs -d search="search index=neteng|head 5"
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...