Dashboards & Visualizations

if then else dashboard help

sgro777
Engager

I'm very new to Splunk.  I have two tokens as input to a dashboard and want to change a query based on which one is entered.  

My base query (with no dashboard) 

eventtype=builder user_id IN (<value1>, <value2>, etc.) | eval .....

I created a dashboard and want to use tokens for the input.  

token1=$id$
token2=$email$


If the token1 has data, I want to execute

eventtype=builder user_id IN ($id$) | eval....

 otherwise, I want to execute 

eventtype=builder user_mail in $email$ | eval .....

 

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @sgro777 ,

sorry, my error, please try:

eventtype=builder (user_id IN ($id$) OR user_mail IN ($email$))
| eval ...

Ciao.

Giuseppe

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your issue may be to do with what you do if the user has not selected a value for either token. A dashboard would normal wait for the user to make a selection. Handling tokens is easier in Classic SimpleXML dashboards than currently available in Studio. Is this an option for you?

0 Karma

sgro777
Engager

If I can't figure it out, I'll try the simple dashboard.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sgro777 ,

did you tried with:

eventtype=builder (user_id IN ($id$) OR user_mail in $email$)
| eval .....

?

Ciao.

Giuseppe

0 Karma

sgro777
Engager

I tried this but it would not work. 

eventtype=builder (user_id IN ($id$) OR user_mail in $email$)
| eval .....

 

I also tried eventtype=builder ((user_id IN ($id$) OR (user_mail IN ($email$))) | eval ... but that only works if both tokens are populated.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sgro777 ,

sorry, my error, please try:

eventtype=builder (user_id IN ($id$) OR user_mail IN ($email$))
| eval ...

Ciao.

Giuseppe

0 Karma

sgro777
Engager

THANK YOU!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sgro777 ,

good for you, see next time!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated by all the Contributors 😉

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 ...