Example: Search progress events using a Simple XML extension

This example uses a Simple XML extension to retrieve the progress of a search, including the status of the search and the properties of the search job.


To use this code:

  1. Save the XML file under an existing app in $SPLUNK_HOME/etc/apps/app_name/local/data/ui/views/.
  2. Save the JS file under $SPLUNK_HOME/etc/apps/app_name/appserver/static/.
  3. Restart Splunk.
  4. Open Splunk Web and view the dashboard in your app. For example, to view myexample in mysplunkapp, go to http://<localhost:port>/app/mysplunkapp/myexample.


<dashboard script="example_progressevents.js">
  <label>Search progress events</label>
            <div class="main-area">
                <p>A search (<tt>index=_internal | head 50000</tt>) runs when the page is loaded. Progress is indicated by displaying the
                number of matching events.</p>
                <p><b>Open the developer console!</b> Search progress is displayed in the console. And, when the search has completed, an object
                containing the properties of the search job is displayed there.</p>
                <h4><div id="progresstext">...status...</div></h4>



], function(SearchManager) {

    // Create the search manager
    var mysearch = new SearchManager({
        id: "search1",
        app: "search",
        cache: false,
        search: "index=_internal | head 50000"

    mysearch.on('search:failed', function(properties) {
        // Print the entire properties object
        console.log("FAILED:", properties);

    mysearch.on('search:progress', function(properties) {
        // Print just the event count from the search job
        console.log("IN PROGRESS.\nEvents so far:", properties.content.eventCount);
        document.getElementById("progresstext").innerHTML="In progress with " + properties.content.eventCount + " events...";

    mysearch.on('search:done', function(properties) {
        // Print the search job properties
        console.log("DONE!\nSearch job properties:", properties.content);