I want to change the group by clause in search command depending upon selected value in drop-down box in dashboard
e.g. Selected value is "All" then group by clause should look like timechart sum(x) group by host
else
Selected value is "Environment" then group by clause should look like timechart sum(x) group by environment
Thanks,
Prashant
You can easily do this with the <change>
option on your input dropdown.
<input id="split_field" searchWhenChanged="true" token="split_field" type="dropdown">
<label>Split-by Field</label>
<choice value="all">All</choice>
...
<choice value="env">Environment</choice>
<default>all</default>
<change>
<condition label="All">
<set token="split_field_opt">host</set>
</condition>
...
<condition label="Environment">
<set token="split_field_opt">environment</set>
</condition>
</change>
</input>
...
<panel>
<chart>
<search><query>YOUR SEARCH | timechart sum(x) group by $split_field_opt$</query></search>
</chart>
</panel>
You can easily do this with the <change>
option on your input dropdown.
<input id="split_field" searchWhenChanged="true" token="split_field" type="dropdown">
<label>Split-by Field</label>
<choice value="all">All</choice>
...
<choice value="env">Environment</choice>
<default>all</default>
<change>
<condition label="All">
<set token="split_field_opt">host</set>
</condition>
...
<condition label="Environment">
<set token="split_field_opt">environment</set>
</condition>
</change>
</input>
...
<panel>
<chart>
<search><query>YOUR SEARCH | timechart sum(x) group by $split_field_opt$</query></search>
</chart>
</panel>