All Apps and Add-ons

How to create a Sankey chart from the Splunk 6.x Dashboard Examples app?

Julieda
Explorer

Hi!

I am trying to create a Sankey chart showing a list of Splunk users, what roles they have, and what indexes they are able to search in. To test Sankey, I wanted to use the example provided in the app "Splunk 6.x Dashboard example", and use that exact example when creating a new Dashboard under the "Search"-app.

The example in the app lists that the Sankey chart consists of 4 files: custom_viz_sankey.xml, autodiscover.js, sankey.js, and sankey.css. I have copied these files into my user area, and beneath the "Search" folder. The dashboard is present in the list of dashboards on my account, but is totally empty when clicking on it.

What am I missing here? Why is the dashboard empty? Are the javascript files not being generated? How can I use the example Sankey chart from the app to modify for my own data?

0 Karma
1 Solution

lnetto
Engager

Copy the following into your app folder from the examples app:


appserver/static/autodiscover.js
appserver/static/components/d3
appserver/static/components/sankey

Create your dashboard and make sure the "data-require" path references your app. Restart Splunk and clear your cache if needed.

<form script="autodiscover.js">
  <label>Sankey Diagram</label>
  <search id="sankey_search">
    <title>My Title</title>
    <query><![CDATA[
      index=* rename src as from dst as to | stats count by from to | head 20
    ]]>
    </query>
    <earliest>1</earliest>
    <latest>now</latest>
  </search>
  <row>
    <panel>
      <html>
                <div id="sankey" class="splunk-view" data-require="app/<app_name>/components/sankey/sankey"
        data-options='{
                            "managerid": "sankey_search",
                            "height": 400
                         }'>
                </div>
            </html>
    </panel>
  </row>
</form>

View solution in original post

0 Karma

lnetto
Engager

Copy the following into your app folder from the examples app:


appserver/static/autodiscover.js
appserver/static/components/d3
appserver/static/components/sankey

Create your dashboard and make sure the "data-require" path references your app. Restart Splunk and clear your cache if needed.

<form script="autodiscover.js">
  <label>Sankey Diagram</label>
  <search id="sankey_search">
    <title>My Title</title>
    <query><![CDATA[
      index=* rename src as from dst as to | stats count by from to | head 20
    ]]>
    </query>
    <earliest>1</earliest>
    <latest>now</latest>
  </search>
  <row>
    <panel>
      <html>
                <div id="sankey" class="splunk-view" data-require="app/<app_name>/components/sankey/sankey"
        data-options='{
                            "managerid": "sankey_search",
                            "height": 400
                         }'>
                </div>
            </html>
    </panel>
  </row>
</form>
0 Karma

DMohn
Motivator

Have you restarted your Splunk instance after moving the files? Changes that invode css and js files generally need a restart to be usable in dashboards.

0 Karma

hylam
Contributor

Don't forget to disable client-side and server-side caches. In chrome go to F12 > Network > Disable cache. On the splunk server edit the appdir/local/web.conf.

==> web.conf <==
[settings]
cacheBytesLimit = 0
cacheEntriesLimit = 0

0 Karma

Julieda
Explorer

Yes, I have restarted Splunk.. Is it necessary to modify the files from the example?

0 Karma

Julieda
Explorer

Update: When clicking on the dashboard I get the following error message:

"XML Syntax Error: error parsing attribute name, line 17, column 9",
which is the following line of code in custom_viz_sankey.xml:

0 Karma
Get Updates on the Splunk Community!

The Splunk Success Framework: Your Guide to Successful Splunk Implementations

Splunk Lantern is a customer success center that provides advice from Splunk experts on valuable data ...

Splunk Training for All: Meet Aspiring Cybersecurity Analyst, Marc Alicea

Splunk Education believes in the value of training and certification in today’s rapidly-changing data-driven ...

Investigate Security and Threat Detection with VirusTotal and Splunk Integration

As security threats and their complexities surge, security analysts deal with increased challenges and ...