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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...