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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...