Skip to content

Splunk SDK IntelliSense

PKing70 edited this page Jan 23, 2020 · 10 revisions

When developing integrations using Splunk Enterprise SDKs like the Python or JavaScript SDK, Visual Studio Code can automatically provide IntelliSense.

Splunk Enterprise Python SDK IntelliSense

Getting Started

For a comprehensive guide, see Get started with the Splunk Enterprise SDK for Python, in Splunk Developer Documentation. This includes installation instructions, documentation, and examples.

Adding the Splunk Enterprise Python SDK to your Splunk App or Add-on

The Splunk Enterprise Python SDK can be packaged with your Splunk app or add-on.

Step 1 - copy the splunklib folder from the SDK to the following location:

$SPLUNK_HOME/etc/apps/your_app_name/bin/lib

Step 2 - append the sys.path in your Python code:

import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib"))

Step 3 - import the desired module

The following is an example for a custom search command:

from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators

Splunk Enterprise JavaScript SDK IntelliSense

Getting Started

For a comprehensive guide, see Get started with the Splunk Enterprise SDK for JavaScript, in Splunk Developer Documentation. This includes installation instructions, documentation, and examples.

Adding the Splunk Enterprise JavaScript SDK to your Project

The Splunk Enterprise JabaScript SDK can be used client-side (browser) or server-side (node). The following is an example for server-side:

Install:

npm install splunk-sdk

Use:

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

Install Visual Studio Code Debugger for Google Chrome (optional)

The Visual Studio Code debugger extension for Google Chrome allows you to debug your JavaScript code in the Google Chrome browser, or other targets that support the Chrome DevTools Protocol.