Created: 2012-03-23 22:05
Updated: 2013-10-15 21:56


Splunk JS SDK

Don't use this. Since I wrote it, Splunk has improved their own SDK for JavaScript and it's now a much better option.

  • Requires jQuery 1.7+ * (really, just requires the jQuery deferred object)

To get this to work, I ended up turning off SSL from within the Splunk management console. Our Splunk installation is internal to our network so this didn't seem like a problem.

splunk.login - returns a Deferred promise object. You must wait until after login is complete to call search.

splunk.search - executes search queries. Very basic at this point. Makes a best effort to return JSON data. Splunk's REST API is surprisingly inconsistent with JSON.


splunk.login('username', 'password', { address: 'http://splunk.internal:8089/' })
   .done(function(obj) {
      splunk.search('my splunk query', '-15m', 'now', baseOpts)
         .done(function(s) {
            console.log('all done!');
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more