Splunk Search

In a statistics table, how do I make it so a row hides when clicked upon?

denys_k
Explorer

Hello guys

I want to hide the row of a table after clicking on a cell on this table. I guess I should look for JS solution
Example: after clicking at "hide me" on 3d row - hide the whole row, how can i implement this?

alt text

0 Karma
1 Solution

niketn
Legend

@denys_k, please try the following run anywhere example which generates a mock up data as per the question and the uses table drilldown with <eval> to set the token to filter unwanted results from the table when action column value is clicked by pulling corresponding id. (PS: The same can also be implemented with slight tweaking to allow filter without adding action column to table when use clicks any other column i.e. id or message in particular row)

<init> section is used to set the filter token to false so that when the table loads all results are displayed. When Hide Me is clicked for a particular row, eval is used to prepare comma separated filter of ids to be removed from table using <eval> and applied to search filter | search NOT id IN ($tokFilterRecord$). Please try out and confirm.

<dashboard>
  <label>Hide Row based on click</label>
  <init>
    <set token="tokFilterRecord">false</set>
  </init>
  <row>
    <panel>
      <title>tokFilterRecord: $tokFilterRecord$</title>
      <table>
        <search>
          <query>| makeresults count=7
| streamstats count as id
| fields - _time
| eval message="Message-".id
| eval action="Hide Me!"
| table id message action
| search NOT id IN ($tokFilterRecord$)</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
        <drilldown>
          <condition field="action">
            <eval token="tokFilterRecord">if($tokFilterRecord$=="false",$row.id$,$tokFilterRecord$.",".$row.id$)</eval>
          </condition>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@denys_k, please try the following run anywhere example which generates a mock up data as per the question and the uses table drilldown with <eval> to set the token to filter unwanted results from the table when action column value is clicked by pulling corresponding id. (PS: The same can also be implemented with slight tweaking to allow filter without adding action column to table when use clicks any other column i.e. id or message in particular row)

<init> section is used to set the filter token to false so that when the table loads all results are displayed. When Hide Me is clicked for a particular row, eval is used to prepare comma separated filter of ids to be removed from table using <eval> and applied to search filter | search NOT id IN ($tokFilterRecord$). Please try out and confirm.

<dashboard>
  <label>Hide Row based on click</label>
  <init>
    <set token="tokFilterRecord">false</set>
  </init>
  <row>
    <panel>
      <title>tokFilterRecord: $tokFilterRecord$</title>
      <table>
        <search>
          <query>| makeresults count=7
| streamstats count as id
| fields - _time
| eval message="Message-".id
| eval action="Hide Me!"
| table id message action
| search NOT id IN ($tokFilterRecord$)</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
        <drilldown>
          <condition field="action">
            <eval token="tokFilterRecord">if($tokFilterRecord$=="false",$row.id$,$tokFilterRecord$.",".$row.id$)</eval>
          </condition>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

denys_k
Explorer

Interesting solution with evaluating token in condition. Thanks!

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...