Splunk Search

Creating a search job.

misteryuku
Communicator

To create a search job one has to

1.use the REST endpoint '/services/search/jobs'.
2.Use the POST method and include the session key as 'Authorization' in the header
3.Provide the search string in the request body.
4.A search ID will be returned as a Response.

Am i right to say these steps are necessary to create a search job?

And so does these steps apply to Java Splunk APIs?

0 Karma

Damien_Dallimor
Ultra Champion

The Java SDK is a programming interface that abstracts the underlying REST API.
So, steps 1-4 are correct , and if you use the Java SDK these will be handled for you.

Service service = new Service("myhost",8089);
service.login("user","pass"); //gets the session key, subsequent operations use this in the Authorization header
Job job = service.getJobs().create("search * |  head 10"); //POST search string to /search/jobs
String searchID = job.getSid();//get search ID
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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