Dashboards & Visualizations

Why does |stats values(x) not work as a dynamic input in a panel on my dashboard?

krwinters11
Path Finder

I am trying to use | stats values(x) as my search string to populate a dynamic input to be used on a panel on my dashboard. It fails to populate, but the search is working fine in the search app. Is there another alternative? I want to get distinct values in a field so my user can change the search for each of the distinct values.

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Your search produces one result with a multi-value field, the input is looking for one result per value. Try one of these:

base search | top 0 x

base search | stats count by x

The first will sort by count per x, the second by value of x.

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Your search produces one result with a multi-value field, the input is looking for one result per value. Try one of these:

base search | top 0 x

base search | stats count by x

The first will sort by count per x, the second by value of x.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You're using Unit2 for value, but there is no field by that name?

krwinters11
Path Finder

That was it! So silly. Thank you for your help!

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Do post the XML fragment defining your input. Without that we're guessing blindly.

0 Karma

krwinters11
Path Finder
  <input type="dropdown" token="u" searchWhenChanged="true">
    <label>Select Unit</label>
    <populatingSearch fieldForLabel="Unit" fieldForValue="Unit2">index=mini sourcetype=tail_mini | stats count by Unit</populatingSearch>
    <prefix>Unit:</prefix>
  </input>
  <chart>
    <title>Average Concentration by Unit</title>
    <searchString>index=mini sourcetype=tail_minicam Unit=$u$  | timechart span=1h avg(Concentration) by Unit</searchString>
    <earliestTime>$field2.earliest$</earliestTime>
    <latestTime>$field2.latest$</latestTime>
    <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
    <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
    <option name="charting.axisTitleX.visibility">visible</option>
    <option name="charting.axisTitleY.visibility">visible</option>
    <option name="charting.axisTitleY2.visibility">visible</option>
    <option name="charting.axisX.scale">linear</option>
    <option name="charting.axisY.scale">linear</option>
    <option name="charting.axisY2.enabled">false</option>
    <option name="charting.axisY2.scale">inherit</option>
    <option name="charting.chart">column</option>
    <option name="charting.chart.nullValueMode">gaps</option>
    <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
    <option name="charting.chart.stackMode">default</option>
    <option name="charting.chart.style">shiny</option>
    <option name="charting.drilldown">all</option>
    <option name="charting.layout.splitSeries">0</option>
    <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
    <option name="charting.legend.placement">right</option>
  </chart>
</panel>
0 Karma

krwinters11
Path Finder

They both work in the search app, but when I use them to dynamically fill my drop down input, I only get one result when I should have 5 or so. Any Ideas?

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...