Splunk Search

Fire Dynamic Search Queries based on Tokens

raja21
Explorer

I have various Inputs and i want to execute different query based of different token input value.

Eg. I have 2 different tokens user_name and user_profile.
I am displaying the results in a Statistical table.

Now my search query is:
index="main" u_name=$user_name$ AND u_profile=$user_profile$

However i want to make the search query as:
if($user_name$) #If $user_name$ token is set
index="main" u_name=$user_name$

if($user_profile$) #If $user_profile$ token is set
index="main" u_profile=$user_profile$

Please help me out.

Tags (1)
0 Karma

woodcock
Esteemed Legend

Have 3 panels.: One that depends on $user_profile$, another that depends on $user_name$, and a third that depends on both.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...