Code examples for SplunkJS Stack (outside Splunk Web)
Splunk is no longer actively developing new features or adding guidance to the SplunkJS stack component.
If you develop applications using the Splunk Web Framework, Splunk encourages new development using the Splunk UI Toolkit (SUIT) instead. SUIT provides component and application development tools, visualizations, a dashboard framework, and documentation. Built with ReactJS, SUIT provides a modern approach for Splunk app front-end development, and is used across Splunk's product suite. SUIT comes with an Examples Gallery containing open-sourced applications showcasing different use cases, including dashboards, visualizations, UI components and more. To learn how to get started and to find out more about what the toolkit can support, check out the Examples Gallery in Splunk UI documentation. For more information, contact webplatform@splunk.com.
The following JavaScript examples show how to use SplunkJS Stack in an app outside of Splunk Web to set up and work with views and search managers using the different components of the Splunk Web Framework:
Code example | Description |
---|---|
Login form | A login form that shows how to log in to Splunk and get a session key using the Splunk Enterprise SDK for JavaScript. |
Basic page | A basic page with a chart and an events viewer displaying results from a search. |
Basic page with a layout | The same basic page as above, but with a Splunk Dashboard (dashboard.css) layout. |
A collection of views on one page | Displays the most common views on one page. Shows how to sync search controls to a search manager and how to populate form controls with static choices and search-based choices. |
Charts | Shows examples of each of the possible chart types. |
Tables with custom renderers | Shows how to display a table that includes a sparkline in the search results, a custom cell renderer, and a custom row renderer. |
Events viewers | Shows examples of each of the possible types of events viewer. |
Maps | Shows the same data displayed on a Splunk map and a Google map. |
Drilldown properties | Shows the result of setting different combinations of drilldown properties for the views that allow drilldown actions. |
Search controls using tokens | Shows how to use tokens to sync search controls to a search manager. |
Search controls using events | Shows how to use change events to sync search controls to a search manager. |
Search progress events | Shows how to retrieve the progress of a search, including the status of the search and the properties of the search job. |
Search results model | Shows how to retrieve the different types of search results from the results model: events, preview, results, and summary. |