Splunk Search

Using token from previous populating search within a second populating search

bcarr12
Path Finder

Hi all,

I am currently using a populating search for several dropdowns in a dashboard. I have one for location, device name, time range etc. I am trying to set up the dashboard in such a way that the location selected will then be plugged into my other populating searches (device name for instance), so only devices for the given location will be showed as options in the dropdown. Is this possible?

Example:
Location

 <input type="dropdown" token="Location">
    <label>Location</label>
    <choice value="*">All Location</choice>
    <populatingSearch fieldForValue="aa" fieldForLabel="aa">
          <![CDATA[index=my_index sourcetype=syslog earliest=-60m |rex field=Location "All Locations\#(?<aa>\w+)" | stats count by aa]]>
    </populatingSearch>

Devices
(Populating search will show all devices regardless of location. I would like this to show only devices in the location I specify in the previous dropdown)

<input type="dropdown" token="Device">
    <label>Device</label>
    <choice value="*">All Devices</choice>
    <populatingSearch fieldForValue="DeviceName" fieldForLabel="DeviceName">
          <![CDATA[index=my_index sourcetype=syslog earliest=-60m | stats count by DeviceName]]>
    </populatingSearch>
</input>
0 Karma

somesoni2
Revered Legend

Try this in dropdown xml for Device

<input type="dropdown" token="Device">
    <label>Device</label>
    <choice value="*">All Devices</choice>
    <populatingSearch fieldForValue="DeviceName" fieldForLabel="DeviceName">
          <![CDATA[index=my_index sourcetype=syslog earliest=-60m |rex field=Location "All Locations\#(?<aa>\w+)" | search aa="$Location$" | stats count by DeviceName ]]>
    </populatingSearch>
</input>
0 Karma

bcarr12
Path Finder

I am using 4.3.5 right now but hope to be on 6.1 soon which I am sure will probably resolve issues like this one!

0 Karma

somesoni2
Revered Legend

What version of Splunk are you using?

0 Karma

bcarr12
Path Finder

It shows "All Devices" after page load and it remains that way after I have selected a location as well.

0 Karma

somesoni2
Revered Legend

The dropdown should show "All Devices" only at page load. Does it show "All Devices" only event after selecting a Location?

0 Karma

bcarr12
Path Finder

Hmm, that doesn't seem to be working...now the dropdown only shows "All Devices". I think the problem is that the dropdowns all populate the moment the dashboard starts, how do I tell the Device to only populate once I have specified Location in the prior dropdown?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...