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!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...