TIPS & TRICKS

Lap Around Splunk Java SDK

We recently released our Java SDK.  I wanted to provide a quick overview of the SDK.

Java SDK Overview

The Java SDK has the most comprehensive coverage of the REST API to date.  We expect our other SDKs that we have to follow suit and provide the same level of coverage as the Java SDK.  We wanted to provide a fuller experience out of the gate for Java developers given the semantics of the language and feedback from existing customers who are doing development in Java on top of Splunk.  Get the Java SDK overview on dev.splunk.com.

Java SDK and IDEs

We have provided project-level support for Eclipse and IntelliJ, and our repository directory structure will work for both of them.  You might be wondering what other IDE capabilities we have or are thinking about.  Right now, this is it, but we are definitely thinking about what else we could be doing to better enable the Java development experience.  So, if you have ideas about IDE-level integrations, would enjoy hearing about those.

Building the SDK

We chose to use ANT for building the Java SDK.  We went with ANT on the first release because it provides the base functionality that we needed initially.  We are also evaluating Maven support prior to a GA release of the SDK.  Again, feedback and comments are welcome.

Java SDK Examples

We have provided a number of examples that show how to interact with the core Java SDK library.  The examples span:

  • Basic search
  • Blocking search
  • One-shot search
  • Real-time search
  • List of available indexes
  • How to tail a file
  • Explorer Example

More about the Explorer Example

We also created an explorer example using NetBeans to show the various settings for your local Splunk instance.  This is a nice way to get details on the surface area of your Splunk installation from the apps, to the indexes to the namespaces.  Running the example is easy:

  • Build the SDK following the instructions on dev.splunk.com .
  • Then go to the dist/examples directory.
  • Run java –jar explorer.jar and you will be all set.

SDK Unit Tests

We also ship the unit tests that we have used to validate the core SDK library.  If we haven’t provided an example in the examples directory of the repo, just check out the Java SDK tests directory and chances are you will find what you are looking for there.  If not, let us know.

Staying Connected

Watch and fork Splunk’s Java SDK SDK is on GitHub.  More information about Splunk’s developer platform can be found at splunk dev website and on Twitter at @splunkdev

----------------------------------------------------
Thanks!
Paul Sanford

Splunk
Posted by

Splunk

Join the Discussion