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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...