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!

Building Reliable Asset and Identity Frameworks in Splunk ES

  Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...