My plan is to make certain chart variables configurable on app level, so that the end user would not have to change each dashboard manually. For example the height of the charts.
What would be the optimal solution? To put it in a lookup file, get it from there on the dashboard in a search and add it as a token? Is there a nicer method?
Hi @imrago
I had used lookup for parameters, check whether it suits your requirement.
<dashboard>
<label>config</label>
<row depends="$hide$">
<panel>
<table>
<search>
<query>| inputlookup config.csv | transpose header_field=param</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<done>
<condition>
<set token="charting.chart_value">$result.charting.chart$</set>
<set token="charting.chart.nullValueMode_value">$result.charting.chart.nullValueMode$</set>
<set token="charting.legend.placement_value">$result.charting.legend.placement$</set>
<set token="charting.chart.stackMode_value">$result.charting.chart.stackMode$</set>
<set token="show">true</set>
</condition>
</done>
</search>
</table>
</panel>
</row>
<row depends="$show$">
<panel>
<chart>
<search>
<query>index="_internal" |stats count by source</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
<option name="charting.chart">$charting.chart_value$</option>
<option name="charting.chart.nullValueMode">$charting.chart.nullValueMode_value$</option>
<option name="charting.legend.placement">$charting.legend.placement_value$</option>
<option name="charting.chart.stackMode">$charting.chart.stackMode_value$</option>
</chart>
</panel>
</row>
</dashboard>
Lookup: config.csv
param,value
charting.chart,area
charting.chart.nullValueMode,zero
charting.legend.placement,right
charting.chart.stackMode,200
Hi @imrago
I had used lookup for parameters, check whether it suits your requirement.
<dashboard>
<label>config</label>
<row depends="$hide$">
<panel>
<table>
<search>
<query>| inputlookup config.csv | transpose header_field=param</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<done>
<condition>
<set token="charting.chart_value">$result.charting.chart$</set>
<set token="charting.chart.nullValueMode_value">$result.charting.chart.nullValueMode$</set>
<set token="charting.legend.placement_value">$result.charting.legend.placement$</set>
<set token="charting.chart.stackMode_value">$result.charting.chart.stackMode$</set>
<set token="show">true</set>
</condition>
</done>
</search>
</table>
</panel>
</row>
<row depends="$show$">
<panel>
<chart>
<search>
<query>index="_internal" |stats count by source</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
<option name="charting.chart">$charting.chart_value$</option>
<option name="charting.chart.nullValueMode">$charting.chart.nullValueMode_value$</option>
<option name="charting.legend.placement">$charting.legend.placement_value$</option>
<option name="charting.chart.stackMode">$charting.chart.stackMode_value$</option>
</chart>
</panel>
</row>
</dashboard>
Lookup: config.csv
param,value
charting.chart,area
charting.chart.nullValueMode,zero
charting.legend.placement,right
charting.chart.stackMode,200
@imrago you can upload the css style to your app ($SPLUNK_HOME/etc/apps/appname/appserver/static) or can do from UI if you have option to save(Manage apps->appname->actions(Edit Properties) ->upload asset) and access it in any dashboard using <form style="stylesheetname.css">
Good point, that is ideal to change the hight, but I would like to control other parameters also, like
<option name="charting.chart">area</option>
<option name="charting.chart.nullValueMode">zero</option>
<option name="charting.legend.placement">right</option>
<option name="charting.chart.stackMode">stacked</option>
<option name="height">200</option>
in a chart.