Dashboards & Visualizations

How to get a token and run a collect when click on submit?

pierre_weg
Path Finder

Hi guys!

I have a dashboard with a text input that are connected with a token ($tk1$) , and a "Submit" button.
What I want is, when click on Submit, to read the typed text on the input, and run a | table... | collect...

Here is my dashboard code:

 

<form version="1.1">
<label>LAB2</label>
<fieldset submitButton="true" autoRun="false">
<input type="text" token="tk3">
<label>Comments</label>
</input>
</fieldset>
<row>
<panel>
<table>
<search>
<query>index=lab sourcetype=lab2 A=$TK1$ B=$TK2$
| eval C="$tk3$"
| table A B C</query>
</search>
</table>
</panel>
</row>
</form>


Labels (2)
0 Karma

Gr0und_Z3r0
Contributor

Surround the tokens with quotes (").... and allow run query as part of SPL safeguards.
https://docs.splunk.com/Documentation/Splunk/9.0.4/Security/SPLsafeguards#SPL_safeguards_for_risky_c... 

<form version="1.1">
<label>LAB2</label>
<fieldset submitButton="true" autoRun="false">
<input type="text" token="tk1">
<label>Token1</label>
</input>
<input type="text" token="tk2">
<label>Token2</label>
</input>
<input type="text" token="tk3">
<label>Comments</label>
</input>
</fieldset>
<row>
<panel>
<table>
<search>
<query>|makeresults
|eval A="$tk1$"
|eval B="$tk2$"
| eval C="$tk3$"
| table A B C
|collect index=summary</query>
</search>
</table>
</panel>
</row>
</form>

Gr0und_Z3r0_0-1679577571115.pngGr0und_Z3r0_1-1679577595042.png

 

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...