Dashboards & Visualizations

How to embed JavaScript and CSS within the dashboard or panel?



I have a dashboard which with javascript and custom style sheet and I have them in $SPLUNK_HOME/etc/apps//appserver/static/

But I want to have that code within the below dashboard code and at the panel level instead of putting the files in /appserver/static/ folder. Can you provide some examples how to put the javascript code and style sheet code within my panel?

Below is my Dashboard code :

<dashboard script="table_cell_highlighting.js" stylesheet="table_cell_highlighting.css">
      <table id="highlight">
          <query>host=abc  source="access.log*"  |stats  perc90(duration) as Duration,perc95(duration) as ninetyfifth by   service_name | sort -count</query>

Any help is appreciated !


You can put CSS inline in an html element under a row element like this

<row depends="hiddenCSS">
      /*insert CSS here, can only reference classes and IDs, no selectors */

You CANNOT embed Javascript inside of a SimpleXML dashboard. It can only be loaded from files like you are doing.

0 Karma
.conf21 Now Fully Virtual!
Register for FREE Today!

We've made .conf21 totally virtual and totally FREE! Our completely online experience will run from 10/19 through 10/20 with some additional events, too!