Splunk Search

How to search for results using Java splunk api

misteryuku
Communicator

How do i call the Java splunk api to search using the splunk search language from the Splunk search endpoint?

0 Karma

Damien_Dallimor
Ultra Champion

Have a look at this example included in the SDK.

There is more info at dev.splunk.com also.

Here is a pseudocode excerpt copied from the above link showing usage of the Java SDK to execute a Splunk search and obtain the results:

Service service = Service.connect(...);
Job job = service.getJobs().create("search * | head 10")
while (!job.isDone()) {
    Thread.sleep(2000);
    job.refresh();
}
InputStream stream = job.getResults();
Get Updates on the Splunk Community!

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 ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...