Splunk Search

Wildcard search from lookup

afulamba
Explorer

Hi,
Is there any way to get all the values in the column from the lookup table to build the default choice option in the drop-down? I want to remove the hard-coded list of hosts in the default and populate it from the look up. I don't want to use static option with All=* as it may pull other host names when I will add the records in the lookup for other environment/location values.
Can some one advise, please?

            <input type="multiselect" token="host" searchWhenChanged="true">
            <label>VM Host</label>
            <prefix>host=</prefix>
            <delimiter> OR host=</delimiter>
            <search>
            <query>| inputlookup gw_host.csv 
            | search environment=stage
            | dedup hostname
            | fields hostname</query>
            <earliest>-15m</earliest>
            <latest>now</latest>
            </search>
            <fieldForLabel>host</fieldForLabel>
            <fieldForValue>hostname</fieldForValue>
            <default>h101,h102,h103</default>
            </input>

File: gw_host.csv
location,environment,hostname
1,stage,h101
2,stage,h102
3,stage,h103

Thanks,
AJ.

0 Karma

afulamba
Explorer

Yes, I am using that query that returns the values appearing in the multiselect options. No issue with that. However, I want to set one more value 'All' as default value in the multiselect which should take the value for all the hosts instead of selecting the individual hosts from the multiselect options. In short, I want to avoid the below hard-coding of the servers and populate it from the lookup table.

h101,h102,h103

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What's wrong with the current query? What results do you get compared to what you want?
Have you tried |inputlookup gw_host.csv where environment=stage?

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Monitoring Postgres with OpenTelemetry

Behind every business-critical application, you’ll find databases. These behind-the-scenes stores power ...

Mastering Synthetic Browser Testing: Pro Tips to Keep Your Web App Running Smoothly

To start, if you're new to synthetic monitoring, I recommend exploring this synthetic monitoring overview. In ...

Splunk Edge Processor | Popular Use Cases to Get Started with Edge Processor

Splunk Edge Processor offers more efficient, flexible data transformation – helping you reduce noise, control ...