Dashboards & Visualizations

Filtering results in an inline drilldown to exclude unrelated events.

RVDowning
Contributor
<form>
  <label>Analytics</label>
  <description/>
  <fieldset submitButton="false" autoRun="true">
    <input type="time" searchWhenChanged="true"/>
  </fieldset>

  <row>
    <panel>
      <chart>
        <title>Datasets Created by Type</title>
        <searchString>host=MA*  Grp=RequestDataset
          | eval RequestType=if(Lvl="DepartmentGroup","Divn",if(IDL="Class","Dept-Cls",if(IDL="Vendor","Dept-Vend","Dept")))
          | chart dc(TId) by RequestType</searchString>
        <option name="charting.chart">pie</option>
        <option name="charting.chart.style">shiny</option>
        <drilldown>
          <set token="type_tok">$click.value$</set>
        </drilldown>
      </chart>
      <table depends="$type_tok$">
        <title>Chart for $type_tok$</title>
        <searchString>host=MA*  Grp=RequestDataset
          | sort _time
          | eval RequestType=if(Lvl="DepartmentGroup","Divn",if(IDL="Class","Dept-Cls",if(IDL="Vendor","Dept-Vend","Dept")))
          | where $type_tok$ = RequestType          
          | eval RequestDate = strftime(_time, "%m-%d")
          | fields _time, $type_tok$, RequestType, Lvl 
        </searchString>
      </table>
    </panel>
  </row>
</form>

I have a pie chart and an inline drilldown. The clicked on value does get passed to the inline search, but how do I filter the results so that only the events corresponding to the clicked on value get displayed?

For example, the user may click on the "Divn" section of the pie chart, and "Divn" gets passed to the inline search. If RequestType = "Divn" then I want the event to display, otherwise not.

It seems I'm not using the Where clause correctly, but I'm not quite sure how to set it up.

1 Solution

somesoni2
Revered Legend

Try this for the drilldown search (2nd search)

host=MA* Grp=RequestDataset [|gentimes start=-1 
   | eval search=case("$type_tok$"="Divn", "Lvl=\"DepartmentGroup\"", 
   "$type_tok$"="Dept-Cls", "IDL=\"Class\"", 
   "$type_tok$"="Dept-Vend", "IDL=\"Vendor\"", "$type_tok$"="Dept", "*") | table search ]
   | eval RequestDate = strftime(_time, "%m-%d") | eval RequestType="$type_tok$"
  | fields _time, $type_tok$, RequestType, Lvl 

View solution in original post

somesoni2
Revered Legend

Try this for the drilldown search (2nd search)

host=MA* Grp=RequestDataset [|gentimes start=-1 
   | eval search=case("$type_tok$"="Divn", "Lvl=\"DepartmentGroup\"", 
   "$type_tok$"="Dept-Cls", "IDL=\"Class\"", 
   "$type_tok$"="Dept-Vend", "IDL=\"Vendor\"", "$type_tok$"="Dept", "*") | table search ]
   | eval RequestDate = strftime(_time, "%m-%d") | eval RequestType="$type_tok$"
  | fields _time, $type_tok$, RequestType, Lvl 

somesoni2
Revered Legend

"|gentimes start=-1 " is just generate single dummy row without accessing any index.

0 Karma

RVDowning
Contributor

Yep, that did it, thanks. Though I don't understand the start=-1 which should just mean one day ago.

0 Karma

RVDowning
Contributor

Sorry, it did not retain the formatting so it appears jumbled.

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...