How to use the Splunk SDK for Java

This section shows how to do the basics with the Splunk SDK for Java and Splunk Enterprise. We're assuming you already followed the instructions in the Getting Started section and were able to run the examples. We're also assuming you know your way around Splunk Web and got your feet wet—you've added some data and saved a search or two. If so, you're ready to start using the SDK to develop Splunk Enterprise applications.

If you try the examples that are included with the SDK, you'll notice that they are all written from a command-line perspective. That is, they start by parsing the parameters that are provided at the command line and the parameters that are defined in the .splunkrc file (the optional file that stores your login credentials for convenience when running the SDK examples, described in Utilities).

For simplicity, the code examples in this section avoid error handling, command-line processing, and complex logic, staying focused simply on showing you how to use the SDK APIs. If you want more advanced real-world examples, see the Java code examples on GitHub.

How to topics

Connect to Splunk Introduces the basic process of connecting to splunkd and logging in.
Work with saved searches Shows how to list, create, and run saved searches.
Work with searches and jobs Shows how to list search jobs and run different types of searches.
Create modular inputs Shows how to programmatically create modular inputs.
Work with data models and pivots Shows how to programmatically work with data models and pivots.
Display search results Shows how to display the results from searches in different formats.
Get data into Splunk Shows how to add, view, and modify your data inputs and indexes.
Work with users and roles Shows how to add, view, and modify the users of the Splunk system and their roles to control access to Splunk.