Splunk Search

Dashboard Studio Dropdown default value from lookup table

splunkuser320
Path Finder

I am trying to replace default value of drop down with all the values from a column in lookup table

Example:

Lookup table 

Namelog_group
Name 1Log1
Name 2log 2
Name 3log3

 

I need drop down default taken as log1,log2,log3

Labels (1)
0 Karma
1 Solution

dural_yyz
Communicator

Ok this is ugly but should be functionable.  After researching I wasn't able to find a method to dynamically assign the default value, but you can default to the first value of the search result.

Source Table

NameValue
Name 01Value 01
Name 02value 02
Name 03value03
Name 04Value04

 

Set your data source to pull from a search designed like the following - modify for your needs.

| inputlookup input_test_values.csv 
| stats values(Value) as Value
| format
| rename search as Value
| eval Name="All"
| table Name Value
| append
[| inputlookup input_test_values.csv
| table Name Value ]

Search Output:

NameValue
All( ( ( Value="Value 01" OR Value="Value04" OR Value="value 02" OR Value="value03" ) ) )
Name 01Value 01
Name 02value 02
Name 03value03
Name 04Value04

 

Your inputs config panel to the right should be able to select "First Value" as the default.  The search as written can display "All" in the drop down while dynamically building the first value based upon the contents of the lookup no matter how many times it is edited.  

The way I have written makes the first value very easy to drop into a subsequent search string.  Your needs may vary so you can play with the format command to get that output as you need it specifically.

View solution in original post

0 Karma

yuanliu
SplunkTrust
SplunkTrust

I need drop down default taken as log1,log2,log3

As @dural_yyz hinted at, the actual solution depends very much on how you will use the input token in search.  If you want the comma delimited list as part of IN function, you can just use appendpipe.

 

| inputlookup mylookup
| appendpipe
    [stats values(log_group) as log_group
    | eval Name = "Any", log_group = mvjoin(log_group, ",")]

 

You get

Namelog_group
Name 1Log1
Name 2log2
Name 3log3
Anylog1,log2,log3

 

 

Tags (2)
0 Karma

dural_yyz
Communicator

Ok this is ugly but should be functionable.  After researching I wasn't able to find a method to dynamically assign the default value, but you can default to the first value of the search result.

Source Table

NameValue
Name 01Value 01
Name 02value 02
Name 03value03
Name 04Value04

 

Set your data source to pull from a search designed like the following - modify for your needs.

| inputlookup input_test_values.csv 
| stats values(Value) as Value
| format
| rename search as Value
| eval Name="All"
| table Name Value
| append
[| inputlookup input_test_values.csv
| table Name Value ]

Search Output:

NameValue
All( ( ( Value="Value 01" OR Value="Value04" OR Value="value 02" OR Value="value03" ) ) )
Name 01Value 01
Name 02value 02
Name 03value03
Name 04Value04

 

Your inputs config panel to the right should be able to select "First Value" as the default.  The search as written can display "All" in the drop down while dynamically building the first value based upon the contents of the lookup no matter how many times it is edited.  

The way I have written makes the first value very easy to drop into a subsequent search string.  Your needs may vary so you can play with the format command to get that output as you need it specifically.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...