Install the SDK

After you've taken care of the prerequisites, you're ready to install the components of the Splunk® SDK for JavaScript.


Get the SDK

Get the Splunk SDK for JavaScript: download the SDK as a ZIP file and extract the files.

Want to verify your download? Download MD5. Download SHA-512.


Client-side installation

The Splunk SDK for JavaScript includes pre-built client-side files that run in a web browser. To install the client-side files, you just need to copy them to your site and include them in your code. The client-side SDK also uses the jQuery library, so you also need jquery.min.js.

To install the client-side files

  1. Copy the /splunk-sdk-javascript/client directory to your site.

  2. Copy jquery.min.js, which is included with the SDK in /splunk-sdk-javascript/examples/browser/resources, to your site.

  3. Include one of the following <script> tags in your client-side code, specifying the correct path to the files on your site:

    <script type="text/javascript" src="/YOUR_PATH/splunk.js"></script>


    <script type="text/javascript" src="/YOUR_PATH/splunk.min.js"></script>

    This tag creates a global variable called splunkjs, which is the root of the SDK. No other global variables are introduced.

  4. Include a <script> tag specifying the correct path to the jquery.min.js file:

    <script type="text/javascript" src="/YOUR_PATH/jquery.min.js"></script>

Server-side installation

The Splunk SDK for JavaScript requires Node.js for server-side scripting. To use the Splunk SDK for JavaScript in your own Node.js programs, install the server-side files and require them in your script.

To install the server-side files

  1. At the command line, go to your project's directory and enter:

    npm install splunk-sdk
  2. Use the require() function in your script as follows:

    var splunkjs = require('splunk-sdk');

Use the Splunk SDK for JavaScript components on your web page

To use the components from the Splunk SDK for JavaScript on your web page, copy the /splunk-sdk-javascript/client directory to your web server. Then, include the splunk.js or splunk.min.js file from this directory in your code.

For example, include one of the following tags in your code:

<script type="text/javascript" src="/yourpath/splunk.js"></script>


<script type="text/javascript" src="/yourpath/splunk.min.js"></script>

You can also include the UI components, such as the Timeline and Charting controls. These UI component files (splunk.ui.timeline and splunk.ui.charting) are also in the /splunk-sdk-javascript/client directory.


Install the Splunk SDK for JavaScript for Node.js apps

Note: The Splunk SDK for JavaScript v1.2.3 and later requires Node.js version 0.8.x or 0.10.x.

If you want to use the Splunk SDK for JavaScript with your Node.js programs, install the SDK by running npm in your project's directory as follows:

npm install splunk-sdk

Then, to include the Splunk SDK for JavaScript, use the require function in your code:

var splunkjs = require('splunk-sdk');