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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...