Splunk Search

How to unset a token in drilldown based on specific column?

rahul_n
Explorer

Hi. 

I am trying to edit a source code of a splunk panel such that, the token should only when the user clicks on a particular column (Not a particular value). 

For example: 

lets consider the below table. 

Column1Column2Column3Column4Column5Column6Column7
value1value2value3value4value5value6value7
value11value22value33value44value55value66value77

 

I want to make changes such that, the token should work only when the user clicks any value in Column1 and Column2 (It can be value1 or value11 or value2 or value22 ). The token should not work when the user clicks on any value from other columns.   

The opened new panel based on token should disappear when user clicks on any value from columns other than column1 and column2. 

 

The source code which I have : 

 

<row>
    <panel>
      <table>
        <title>Stats by user(Click on a value for further info)</title>
        <search>
          <query> SOME BUSINESS SPLUNK QUERY)</query>
          <earliest>$startTime.earliest$</earliest>
          <latest>$startTime.latest$</latest>
          <refresh>5m</refresh>
          <refreshType>delay</refreshType>
        </search>'<option name="count">20</option>
        <option name="dataOverlayMode">heatmap</option>
        <option name="drilldown">cell</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <drilldown>
          <condition>
            <set token="value">$click.value2$</set>
          </condition>
        </drilldown>
      </table>
    </panel>
  </row>
  <row depends="$value$">
    <panel>
      <title>Usage of $value$</title>
      <chart>
        <search>
          <query> ANOTHER SPLUNK QUERY</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">none</option>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <unset token="value"></unset>
        </drilldown>
      </chart>
    </panel>
  </row>

 

 

Please help me to add a condition to unset token based on column.

Any help is greatly appreciated. 

 

Thanks in Advance.

Labels (7)
0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

Try below run anywhere example

Token is set to the clicked value for column 1 or column 2 and unset for other columns.

 

<dashboard>
  <label>Conditional Token</label>
  <row>
    <panel>
      <html>
        <h2>
          Token Value : <font color="red">$token_value$</font>
        </h2>
      </html>
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults count=5|streamstats count| eval column1=count."_column1", column2=count."_column2", column3=count."_column3", column4=count."_column4"</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">cell</option>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <condition field="column1">
            <set token="token_value">$click.value2$</set>
          </condition>
          <condition field="column2">
            <set token="token_value">$click.value2$</set>
          </condition>
          <condition>
            <unset token="token_value">$click.value2$</unset>
          </condition>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>

 

 

Happy Splunking!

View solution in original post

renjith_nair
SplunkTrust
SplunkTrust

Try below run anywhere example

Token is set to the clicked value for column 1 or column 2 and unset for other columns.

 

<dashboard>
  <label>Conditional Token</label>
  <row>
    <panel>
      <html>
        <h2>
          Token Value : <font color="red">$token_value$</font>
        </h2>
      </html>
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults count=5|streamstats count| eval column1=count."_column1", column2=count."_column2", column3=count."_column3", column4=count."_column4"</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">cell</option>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <condition field="column1">
            <set token="token_value">$click.value2$</set>
          </condition>
          <condition field="column2">
            <set token="token_value">$click.value2$</set>
          </condition>
          <condition>
            <unset token="token_value">$click.value2$</unset>
          </condition>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>

 

 

Happy Splunking!

rahul_n
Explorer

Thanks @renjith_nair for the solution. 

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...