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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...