Skip to content

Splunk SDK IntelliSense

JasonConger edited this page Jan 12, 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

A comprehensive guide to getting started with the Splunk Enterprise Python SDK is available at dev.splunk.com including 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 within 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

Visual Studio Code will provide IntelliSense for the SDK

images/sdk-python1.gif

Splunk Enterprise JavaScript SDK IntelliSense

Getting Started

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.