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.

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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...