Dashboards & Visualizations

How to display results for several users using a multi-select dropdown on a dashboard?

matthew_foos
Path Finder

Splunkers,

I'm trying to display the results for several users using a multi-select dropdown on a dashboard. The results for one user will display correctly. When I add a second, third, fourth, etc user, I get no results found.

Here is the SPL for the panel:

index=trn5 source="*trn5/logs/system/access.log" NOT user="SYSUSER" NOT user="-" NOT user="USER01" NOT user="USER03" NOT user="USER04" NOT user="user10" NOT user="user11" NOT user="b12663"
| lookup cis_users.csv userid AS user
| search username="$input_user2$"
| eval day=strftime(_time, "%B %d %Y") 
| eventstats range(_time) AS duration BY username day
| stats values(duration) as duration by username day
| eval duration=tostring(duration, "duration")
| rename username as User, day as Date, duration as "Time in Portal"

SPL for the dropdown:

index=trn5 
 | lookup cis_users.csv userid AS user
 | fields username
 | table username
 | dedup username
 | sort 0 username

Field for Label: username
Field for Value: username

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi matthew.foos,
how do you configured multi select dropdown? did you remember to put " OR " (with spaces)
in other word in the multiselect you need

  <valuePrefix>username="</valuePrefix>
  <delimiter> OR </delimiter>
  <default>*</default>
  <valueSuffix>"</valueSuffix>

then in the search you have to insert

| search $input_user2$

in this way you can manage the multi selection otherwise you can use only one value.

One additional information: use OUTPUT in lookup command

Bye.
Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi matthew.foos,
how do you configured multi select dropdown? did you remember to put " OR " (with spaces)
in other word in the multiselect you need

  <valuePrefix>username="</valuePrefix>
  <delimiter> OR </delimiter>
  <default>*</default>
  <valueSuffix>"</valueSuffix>

then in the search you have to insert

| search $input_user2$

in this way you can manage the multi selection otherwise you can use only one value.

One additional information: use OUTPUT in lookup command

Bye.
Giuseppe

matthew_foos
Path Finder

Nailed it.

0 Karma

kmaron
Motivator

can you share the XML for your dropdown?

0 Karma

matthew_foos
Path Finder
  <input type="multiselect" token="input_user2" searchWhenChanged="true">
    <label>Select a User(s):</label>
    <fieldForLabel>username</fieldForLabel>
    <fieldForValue>username</fieldForValue>
    <search>
      <query>index=trn5 

| lookup cis_users.csv userid AS user
| fields username
| table username
| dedup username
| sort 0 username
-30d@d
now


0 Karma

kmaron
Motivator

It looks like you're missing the OR setup. @cusello mentioned it below

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...