Dashboards & Visualizations

drop down populating the search

DTERM
Contributor

I want to populate a dropdown search with the following results:

index=myapp | top tgtHostname | fields tgtHostname

So the dropdown will only have the top 10 fields designatd as tgtHostname

here is my code.

<populatingSearch fieldForValue="tgtHostname" fieldForLabel="tgtHostname">| metadata type=tgtHostname index=myapp</populatingSearch>

Why does that not work? The drop down is visually there but it does not contain the list generated by the query.

Thanks.

Tags (1)
1 Solution

rroberts
Splunk Employee
Splunk Employee

You need two searches.
The second actually populates the selection box.


<!-- define master search template, with replacement tokens delimited with $ -->
<searchTemplate>index=_internal source=*metrics.log group="per_sourcetype_thruput" series=$series$ | fields eps, kb, kbps</searchTemplate>
<earliestTime>-30d</earliestTime>
<latestTime>-0d</latestTime>

<fieldset>
    <!-- Define a simple dropdown form driven by a search -->
    <input type="dropdown" token="series">
        <label>Select series</label>
        <populatingSearch fieldForValue="series" fieldForLabel="series"><![CDATA[index=_internal source=*metrics.log group="per_sourcetype_thruput" | top series]]></populatingSearch>
        <choice value="*">Any</choice>
    </input>
</fieldset>

<row>
    <!-- output the results as a 50 row events table -->
    <table>
        <title>Matching events</title>
        <option name="count">50</option>
    </table>
</row>

View solution in original post

rroberts
Splunk Employee
Splunk Employee

You need two searches.
The second actually populates the selection box.


<!-- define master search template, with replacement tokens delimited with $ -->
<searchTemplate>index=_internal source=*metrics.log group="per_sourcetype_thruput" series=$series$ | fields eps, kb, kbps</searchTemplate>
<earliestTime>-30d</earliestTime>
<latestTime>-0d</latestTime>

<fieldset>
    <!-- Define a simple dropdown form driven by a search -->
    <input type="dropdown" token="series">
        <label>Select series</label>
        <populatingSearch fieldForValue="series" fieldForLabel="series"><![CDATA[index=_internal source=*metrics.log group="per_sourcetype_thruput" | top series]]></populatingSearch>
        <choice value="*">Any</choice>
    </input>
</fieldset>

<row>
    <!-- output the results as a 50 row events table -->
    <table>
        <title>Matching events</title>
        <option name="count">50</option>
    </table>
</row>

DTERM
Contributor

got thanks....

0 Karma

DTERM
Contributor

I think I have that. The query itself is not giving me the desired results.

Perhaps the better question would be, how to take this query

index=myapp | top tgtHostname | fields tgtHostname

ans place it in the populatingSearch tag?

Thank you.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...