Splunk SDK for Java Examples

The Splunk SDK for Java provides a number of examples that show how to interact with the core Splunk SDK for Java library. The examples span:

  • Basic search
  • Blocking search
  • One-shot search
  • Real-time search
  • Tail search
  • Available indexes list
  • System information
  • Splunk explorer

More about the Splunk Explorer example

For a quick introduction to the SDK examples, try out the Splunk Explorer example. It was created using NetBeans and shows the values of various settings from your local Splunk instance. This is a great way to get details about your Splunk installation—from listing your apps, to your indexes, to inputs.

To run the example (assuming you set up the requirements and installed the SDK):

  • Open a command line, go to the /splunk-sdk-java/dist/examples directory, then enter:
    java -jar explorer.jar
  • If you didn't set up the .splunkrc file with your login info, you'll need to include your login credentials at the command line:
    java -jar explorer.jar --username="admin" --password="changeme" 

Next steps

It's time to start playing with the SDK: