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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...