Splunk Search

Can I dynamically filter on the table?

HattrickNZ
Motivator

Let's say I create the following table from my search index= x .... | stats sum(x) by y

y        sum(x)
Counter1  907
Counter2  906
Counter3  904
Counter41 91
Counter42 56
...
CounterN  95

Can I filter the table so it is dynamic so that only some rows are shown? For example, if I just wanted to show the 2 rows

Counter41 91
Counter42 56 

Can I have a text field that can act as my filter where I would type something like "Counter4"

My text field would look something like this:

<input type="text" token="span_gran">
  <label>Specify text to filter table</label>
  <default></default>
</input>

But, firstly, can I dynamically filter on the table and secondly, how do I do this?

0 Karma

niketn
Legend

@HattrickNZ, yes you can filter with your text box.

Following example of Textbox input does two things:
1) When pattern is changed in Text Box, filter token is supplied to Table(without Submit button). You can change this if your use case requires Submit button through searchWhenChanged

2) Default pattern is set to asterix ( * ), so that no filter is applied

 <input type="text" token="span_gran"  searchWhenChanged="true">
   <label>Pattern to Filter</label>
   <default>*</default>
 </input>

Then you can use Text box token in your Search

<YourBaseSearch>
| stats sum(x) by y
| search y="$span_gran$"
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@HattrickNZ, were you able to try out the example. Please let us know if you still have issues.

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

HattrickNZ
Motivator
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 ...