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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...