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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...