Splunk Enterprise

run specific query depens on token value

spisiakmi
Communicator

Hi,

on a dashboard I have a simple check box element: LastOne_tkn (token name). If the check box is enabled, the LastOne_tkn=TRUE. There is simple small table view, which shows some results. I would like to run query in that table view based on LastOne_tkn condition.

LastOne_tkn=TRUE (dedup activated)

index=machinedata
| dedup Attr1
| table Attr1, Attr2

LastOne_tkn=otherwise (dedup deactivated)


index=machinedata
| table Attr1, Attr2

Any idea, please?

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Rather than setting the value to true, set it to the line you want in your search

    <input type="checkbox" token="LastOne_tkn">
      <label>Dedup</label>
      <choice value="| dedup Attr1">Dedup</choice>
      <default></default>
      <initialValue></initialValue>
    </input>

Then use the token in your search

index=machinedata
$LastOne_tkn$
| table Attr1, Attr2

 

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Rather than setting the value to true, set it to the line you want in your search

    <input type="checkbox" token="LastOne_tkn">
      <label>Dedup</label>
      <choice value="| dedup Attr1">Dedup</choice>
      <default></default>
      <initialValue></initialValue>
    </input>

Then use the token in your search

index=machinedata
$LastOne_tkn$
| table Attr1, Attr2

 

0 Karma

spisiakmi
Communicator

Hi ITWhisperer,

exactly this very simple elegant solution I needed. Thank you very much. Works fine.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...