Dashboards & Visualizations

Run search in a dashboard if a token has a value in it

jhmoen
New Member

I have a dashboard with textbox used for a search. I would think this is simple but don't see any examples of this out there. I only want to run the dashboard query if the token (textbox) has a value in it. If it does, then run the query, which does work on its own. But if not, then don't run it.

|eval result = if(isnull($LotNumber$),"", sourcetype=xyx |search $LotNumber$) | table result
0 Karma

cmerriman
Super Champion

is your textbox input (token) in your query? The search shouldn't run if it is waiting for a token. the panel would say "Waiting for Input" or something like that until a token was submitted via textbox. In your search, you would just need something like field=$LotNumber|s$

0 Karma

jhmoen
New Member

It is in my query. I simply want:
sourcetype=xyz |search $LotNumber$
This works, but when the page first loads, I get all the results from sourcetype=xyz. I basically want it to wait for the input, then do the search. Likewise, once one is searched, if you were to clear out the textbox and click submit, you would get nothing again (like page load)

0 Karma

javanzato
New Member

Just in case you never figured this out - you should edit the source so that instead of

<search>
.....

it should be

<search depends="$yourtoken$">
....
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...