Dashboards & Visualizations
Highlighted

Using Single Value Decorations

Communicator

I'm building a dashboard panel and want to use the Single Value Decorations.

Dashboard :

<dashboard stylesheet="single_decorations.css">
    <label>Single Value Decorations</label>
 <row>
    <single>
        <searchString>| stats count as value | eval value = 550 | rangemap field=value none=0-99 low=100-199 guarded=200-299 elevated=300-399 high=400-499 severe=500-599 default=none</searchString>
        <earliestTime>-15m</earliestTime>
        <latestTime>now</latestTime>
        <option name="classField">range</option>
        <option name="field">value</option>
    </single>
....................................

The dashboard and single_decorations.css are placed in ../local/data/ui/views

When the dashboard is displayed the icons are not displayed, and I guess that i have to provide a bunch of other js files to use the Simple XML Extensions, but I'm able from the documentation to find any reference on what is needed - files etc. to use the extensions. What css, js a.s.f has to be copied where.

Tags (1)
0 Karma
Highlighted

Re: Using Single Value Decorations

Splunk Employee
Splunk Employee

The example you are looking for is here in the Splunk 6 Dashboard Examples App. You'll note that it only requires some custom .css

The documentation as to how to handle custom css is here:
http://docs.splunk.com/Documentation/Splunk/6.0/Viz/CustomizeSimpleXML where it explains about the new default dashboard.css and dashboard.js (used to be application.css) which you can think of as the default. These are found in the following folder:

$SPLUNK_HOME/etc/apps/{appname}/appserver/static/
Just like with any 'default' in Splunk you should leave that alone so that you don't lose changes upon upgrade. But you put your custom .css file, in this case single_decorations.css in the same folder.

So to be clear... your css does NOT go in the same folder(directory) with the dashboard xml file... reason being the

$SPLUNK_HOME/etc/apps/{appname}/local/data/ui/views/
folder is managed in the GUI and expects to find xml files... your views and only those files...

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!

View solution in original post

Highlighted

Re: Using Single Value Decorations

Communicator

I was looking at the Splunk 6 Dashboard Example App. and from what I figured out by now is.
When you create a new app you have to copy
dashboard.css
dashboard.js
single_decorations.css

from simplexmlexamples app home.
to the $SPLUNK_HOME/etc/apps/{appname}/appserver/static/

The directory is not initially created so you have to do that yourself.
Edit the dashboard.js file and set the var APP = {appname};

Create a dashboard + panel and have the dashboard load the css =

0 Karma
Highlighted

Re: Using Single Value Decorations

Splunk Employee
Splunk Employee

well, yes and no.

Yes, you must add the stylesheet to the dashboard tag. That's in the instructions in the example.

the dashboard.js and dashboard.css from the simplexmlexamples app are customized defaults for that app specifically. if you look carefully at the dashboards.js you'll note that's the js for the 'reveal' tabs below the examples. You don't need those to make the examples work. All you needed was the single_decorations.css file in your ..etc/apps/yourapp/appserver/static/ directory

which yes... you did have to create as it is only required if you are a "developer" .

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma
Highlighted

Re: Using Single Value Decorations

Influencer

Also note that you have to restart Splunk (or just splunkweb) after you put new files into the appserver/static folder of an app.

Highlighted

Re: Using Single Value Decorations

Communicator

Thanks - yes indeed only the css is necessary + restart of splunkweb

0 Karma
Highlighted

Re: Using Single Value Decorations

Communicator

In the splunk 6 dashboard examples at the top they call out both scripts that are needed:

<dashboard script="single_trend.js" stylesheet="single_trend.css">

Both files can be found here:
/opt/splunk/etc/apps/simplexmlexamples/appserver/static/

To use them in your app copy them here:
/opt/splunk/etc/apps/{your app}/appserver/static/

Restart Splunk to get them loaded.

0 Karma
Highlighted

Re: Using Single Value Decorations

Splunk Employee
Splunk Employee

This is already answered and accepted.

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma