Dashboards & Visualizations

Using Drilldown to search for a value in a look up to set a token

robertlynch2020
Motivator

Hi

I am trying to set a token from a drilldown.

I am able to to this, however the value that comes back is only for display, the real value is in a lookup table.

NICKNAME    Human_Name_Nickname
mx  MX_BASIC
smcrisk_engine  RISK_ENGINE
mxtraderepository_engine    MX_TRADE_REPO_ENGINE
smcobjectrepository_engine  SM_ENGINE
mxmlexchange_mxtaskxa   MXMLEXCHANGE
mxdealscanner_engine    DEAL_SCANNER
mx_cesar    CESAR
mx_marketdata_repository_engine MARKET_DATA
mxprocessingscript  PROCESSING_SCRIPT

So i need to take the value on the screen go to the look up and comeback with the real value.
I am trying to do this by taking $trellis.value$, putting it into a lookuptable and getting back the correct answer.

So for example, i display "MX_BASIC", i want to set the token to "mx" as this is the underlining value i need to pass into the token.

<drilldown>
          <!--set token="form.NICKNAME_TOKEN">$trellis.value$</set-->
          <set token="SINGLE_CLICK_NICKNAME">ON</set>
           <eval token="form.NICKNAME_TOKEN">| inputlookup  TEST_MXTIMING_NICKNAME.csv |  search Human_Name_Nickname = $trellis.value$ | fields - Human_Name_Nickname</eval>
        </drilldown>
0 Karma
1 Solution

niketn
Legend

@robertlynch2020, you can pass on the token from trellis drilldown to a search which can perform inputlookup to fetch the result and set the form variable through Search Event Handler.

Add the following new search to your dashboard (below description)

    <search>
      <query>| inputlookup  TEST_MXTIMING_NICKNAME.csv where Human_Name_Nickname = "$trellis.value$" | fields NICKNAME
      </query>
      <progress>
          <set token="form.NICKNAME_TOKEN">$result.NICKNAME$</set>
      </progress>
    </search>

Modify your Trellis drilldown code to pass on clicked value as token to the search.

    <drilldown>
       <set token="tokHumanNameNickName">$trellis.value$</set>
       <set token="SINGLE_CLICK_NICKNAME">ON</set>
    </drilldown>

PS: Use of eval to set token can only perform eval functions that too with some restrictions which you should check in Splunk Documentation: http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Define_token_filtering_and_formatting

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@robertlynch2020, you can pass on the token from trellis drilldown to a search which can perform inputlookup to fetch the result and set the form variable through Search Event Handler.

Add the following new search to your dashboard (below description)

    <search>
      <query>| inputlookup  TEST_MXTIMING_NICKNAME.csv where Human_Name_Nickname = "$trellis.value$" | fields NICKNAME
      </query>
      <progress>
          <set token="form.NICKNAME_TOKEN">$result.NICKNAME$</set>
      </progress>
    </search>

Modify your Trellis drilldown code to pass on clicked value as token to the search.

    <drilldown>
       <set token="tokHumanNameNickName">$trellis.value$</set>
       <set token="SINGLE_CLICK_NICKNAME">ON</set>
    </drilldown>

PS: Use of eval to set token can only perform eval functions that too with some restrictions which you should check in Splunk Documentation: http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Define_token_filtering_and_formatting

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

robertlynch2020
Motivator

Cheers. Great stuff.

0 Karma
Get Updates on the Splunk Community!

Infographic provides the TL;DR for the 2023 Splunk Career Impact Report

We’ve been shouting it from the rooftops! The findings from the 2023 Splunk Career Impact Report showing that ...

Splunk Lantern | Getting Started with Edge Processor, Machine Learning Toolkit ...

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

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...