Create custom visualizations for Dashboard Studio with the Splunk dashboard extension CLI
Use the CLI to scaffold, build, and package custom visualizations as Splunk apps, configure visualization behavior, and troubleshoot common project and packaging errors.
You can use @splunk/create --mode=dashboard-studio-extension to scaffold a custom visualization project and package it as a Splunk app (.spl file) that can be installed for use in Splunk Dashboard Studio. This process consists of the following steps:
-
Create the custom visualization project.
-
Build the custom visualization using
build. -
Package the visualization as a Splunk app.
-
(Optional) Add visualizations to the existing project.
Prerequisites
-
Node.js 22.0.0 or higher
-
One of the following:
-
npm 10 or higher
-
Yarn 1.22 or higher
-
Create the custom visualization project
You can create a custom visualization project using one of the following ways:
npm create @splunk/create@latest --mode=dashboard-studio-extension
yarn create @splunk/create@latest --mode=dashboard-studio-extension
| Detail | Description | Default value |
|---|---|---|
| Project name | Can only consist of letters, numbers, and underscores. It cannot include a slash or leading dot. There must also be no existing directory with the name. | my_custom_viz |
| Visualization label | Name displayed for the custom visualization in the Splunk UI | Automatically suggested from the project name |
| Description | Description for the custom visualization | A custom visualization for Splunk Dashboard Studio |
| Author | Author name | n/a |
| Template choice | JavaScript or React + JavaScript | JavaScript |
project-name + --template to skip all prompts.
You can choose one of the following templates for your project. The templates include a working example of a custom table visualization.
| Template | Dependencies | Entry point | Key API | Description |
|---|---|---|---|---|
JavaScript (--template javascript) |
|
visualization.js (plain JavaScript, no framework) | VisualizationAPI.addDataSourcesListener(({ dataSources, loading }) => { ... }) |
|
React (--template react) |
|
visualization.jsx (JSX) | useDataSources() hook → { dataSources, loading } |
Recommended for:
|
my_viz/
├── package.json # Node scripts & devDependencies
├── README.md
├── build.mjs # esbuild build script
├── package.mjs # Packager script (runs packaging logic)
├── build-plugins/
│ └── css-and-size.mjs # esbuild CSS injection + bundle size warnings
├── package/
│ └── app/
│ └── app.conf # Splunk app identity (source of truth)
└── visualizations/
└── my_viz/ # One visualization per subdirectory
├── config.json # Viz metadata for Splunk
└── src/
├── visualization.js (or .jsx)
├── visualization.css
└── assets/
└── ChartColumnSquare.svg
yarn build generates a dist/ directory:
dist/
└── my_viz/
└── visualization.js # Bundled output
Bundle the custom visualization using build
cd my_viz
yarn install # Install dependencies
yarn build # One-time build → dist/
yarn dev # Watch mode (rebuilds on file changes)
yarn build:prod # Production build (minified, no sourcemaps)
yarn package # Package into a .spl Splunk app
esbuild to bundle each visualization's src/visualization.js (or .jsx). The build system automatically discovers all subdirectories of visualizations/. Each subdirectory is its own bundle entry point. The build system outputs dist/{vizName}/visualization.js per visualization. CSS is injected directly into the JS bundle, with no separate CSS file needed. Assets (SVG, images, fonts) are inlined as data URLs. Watch mode (yarn dev) creates persistent esbuild contexts for fast rebuilds.
{
"config": {
"name": "My Visualization",
"description": "...",
"category": "Custom",
"icon": null,
"dataContract": {
"requiredDataSources": ["primary"],
"optionalDataSources": []
},
"size": {
"initialWidth": 400,
"initialHeight": 300
},
"optionsSchema": {},
"editorConfig": []
},
"showTitleAndDescription": true,
"includeInToolbar": true,
"includeInVizSwitcher": true,
"showDrilldown": false,
"canSetTokens": [],
"hasEventHandlers": false
}
| Field | Purpose |
|---|---|
|
|
Display name in Splunk UI |
|
|
Toolbar category grouping |
|
|
|
|
|
Initial dimensions when dropped onto a dashboard |
|
|
Whether it appears in the Dashboard Studio visualization list |
|
|
Whether it appears in the visualization type switcher |
[package]
id = my_viz # Splunk app ID
[ui]
is_visible = 1
label = My Visualization
[launcher]
author = Your Name
description = A custom viz
version = 0.1.0
[install]
is_configured = 0
build = <auto-populated from git hash>
[manifest]
category = Custom
Package the visualization as a Splunk app
You can use yarn package to package the visualization. yarn package does the following:
-
Validate project structure. Checks for package.json, visualizations/ directory, config.json in each visualization directory and built dist/{vizName}/visualization.js files.
-
Read package/app/app.conf for app identity (id, version, label, author, etc.).
-
Create staging directory at stage/{appId}/ with the full Splunk app directory layout.
-
Copy each built dist/{vizName}/visualization.js to appserver/static/visualizations/{vizName}/visualization.js. Copy source maps if present.
-
Generate Splunk config files:
-
default/visualizations.conf: register each visualization with Splunk (label, description,
framework_type = studio_visualization) -
metadata/default.meta: set export permissions (
export = system)
-
-
Generate
app.manifest(JSON manifest Splunk uses for app inspection). -
Create
.splarchive indist/{appId}-{version}-{7-char-git-hash}.spl.
The output of yarn package is as follows:
-
stage/{appId}/: staged app directory (useful for debugging app structure)
-
dist/{appId}-{version}-{hash}.spl: installable Splunk app file. A .spl file is a gzipped tar archive (.tar.gz with a different extension). The archive contains a single top-level directory named after the app ID, which contains the full Splunk app structure. You can install it via Install app from file in Splunk Enterprise.
Add visualizations to an existing project
The packager automatically discovers all subdirectories of visualizations/. To add more visualizations to an existing project, do the following:
-
Create visualizations/my_new_viz/ with config.json and src/visualization.js.
-
Run
yarn build && yarn packageto bundle all visualizations in the project into the same .spl file.
Troubleshoot
| Error | Cause | Fix |
|---|---|---|
|
|
Not in a project directory |
|
|
|
Wrong directory |
Run from project root. |
|
|
Viz directory missing config |
Add config.json to each viz directory. |
|
|
Not built yet |
Run |
|
|
Old project or wrong directory |
Ensure package/app/app.conf exists. |
|
|
ID has unsupported characters, such as uppercase and spaces. |
Use only lowercase letters, numbers, hyphens, and underscores. |
|
|
Duplicate project name |
Choose a different project name. |