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!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...