Splunk Search

Extract fields from drop down option and use in search

thenormalone
Path Finder

I have a drop down in my dashboard which looks up a csv file having client information in one of the rows named domain and is of the form "<number>.<client_name>.<network>".

Eg: s122.clientA.cmbs.com

My drop down is configured as below

 

<input type="dropdown" token="token" searchWhenChanged="true">
<label>Client</label>
<choice value="*">All</choice>
<initialValue>*</initialValue>
<fieldForLabel>display</fieldForLabel>
<fieldForValue>domain</fieldForValue>
<search>
<query>| inputlookup domains.csv</query>
<earliest>0</earliest>
<latest></latest>
</search>
<default>*</default>
</input>

 


Then in my search, I'm just appending "... AND client=$domain$" but in this case the domain value will be client=s122.clientA.cmbs.com. How do I extract only the client name from the drop down and use that in the search instead? 

Eg: client=*clientA* should be appended to the search after extraction instead of the whole string (client=*s122.clientA.cmbs.com*)

 

Labels (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Edit the search query to extract the client.

<input type="dropdown" token="token" searchWhenChanged="true">
<label>Client</label>
<choice value="*">All</choice>
<initialValue>*</initialValue>
<fieldForLabel>display</fieldForLabel>
<fieldForValue>client</fieldForValue>
<search>
<query>| inputlookup domains.csv
| eval client=mvindex(split(domain),"."),0)</query>
<earliest>0</earliest>
<latest></latest>
</search>
<default>*</default>
</input>
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Edit the search query to extract the client.

<input type="dropdown" token="token" searchWhenChanged="true">
<label>Client</label>
<choice value="*">All</choice>
<initialValue>*</initialValue>
<fieldForLabel>display</fieldForLabel>
<fieldForValue>client</fieldForValue>
<search>
<query>| inputlookup domains.csv
| eval client=mvindex(split(domain),"."),0)</query>
<earliest>0</earliest>
<latest></latest>
</search>
<default>*</default>
</input>
---
If this reply helps you, Karma would be appreciated.

thenormalone
Path Finder

I was able to get it by slightly altering the search

| eval client=mvindex(split(domain,"."),1)

 

Thanks!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...