Hi Splunkers,
I have a table that displays a value and corresponding to that the number of time that value has occurred. By default the table header is colored as Blue. I want to change the table header to Grey if the values returned are zero, or the search returns no results.
I do not have access to .js. i can only make changes using simple XML. i have been trying to find a solution to this for quite some time now but i have had no success at all. Any leads would be wonderful.
This is how my table looks right now when there is no data
@niketn if possible could you help me out with this. I hear you are a legend around here.
Try this run anywhere example in simple XML
<form>
<label>Table Header Color</label>
<fieldset submitButton="false">
<input type="radio" token="sourcetype">
<label>Sourcetype</label>
<choice value="splunkd">Splunk</choice>
<choice value="invalid">Invalid</choice>
<default>splunkd</default>
<initialValue>splunkd</initialValue>
</input>
</fieldset>
<row>
<panel depends="$alwaysHideCSSStyle$">
<html>
<style>
.table th {
background-color: $th_color$ !important;
}
</style>
</html>
</panel>
</row>
<row>
<panel>
<table>
<search>
<done>
<condition match="$result.count$ > 0">
<set token="th_color">green</set>
</condition>
<condition>
<set token="th_color">red</set>
</condition>
</done>
<query>index=_internal sourcetype="$sourcetype$"|stats count by sourcetype
| appendpipe [stats count | where count=0]</query>
<earliest>-5m</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>
</row>
</form>
Use the radio button to control the count and test. You may change the colors and condition according to your requirement
Try this run anywhere example in simple XML
<form>
<label>Table Header Color</label>
<fieldset submitButton="false">
<input type="radio" token="sourcetype">
<label>Sourcetype</label>
<choice value="splunkd">Splunk</choice>
<choice value="invalid">Invalid</choice>
<default>splunkd</default>
<initialValue>splunkd</initialValue>
</input>
</fieldset>
<row>
<panel depends="$alwaysHideCSSStyle$">
<html>
<style>
.table th {
background-color: $th_color$ !important;
}
</style>
</html>
</panel>
</row>
<row>
<panel>
<table>
<search>
<done>
<condition match="$result.count$ > 0">
<set token="th_color">green</set>
</condition>
<condition>
<set token="th_color">red</set>
</condition>
</done>
<query>index=_internal sourcetype="$sourcetype$"|stats count by sourcetype
| appendpipe [stats count | where count=0]</query>
<earliest>-5m</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>
</row>
</form>
Use the radio button to control the count and test. You may change the colors and condition according to your requirement
thanks for the help. it worked out like a charm
Thanks for the reply. i will test this out and let you know if this works for me. Thanks a ton.