Dashboards & Visualizations

How to change panel visibility based on tokens set by another panel search?

samjoshiacademi
Explorer

I have 4 panels.

  1. 1st Panel gives me Good vs Bad Services stats.
  2. 2nd Panel gives me Error Count
  3. I want to display 3rd panel if first two Panels looks good(1st Panel - 10 Good Services and 0 Bad Services..... 2nd Panel - 0 ErrorCount) And, i will show 4th panel if first two panels looks otherwise (with an issue).

****Code ::
//1st Panel//

  <table>
    <search id="dms2">
      <query><somesearch>| chart count over Validation by Status</query>
      <earliest>-24h@h</earliest>
      <latest>now</latest>
      <done>
      <eval token="dms01">false</eval>
      </done>
      <progress>
         <condition match="$result.Good$ < 7">
           <set token="dms01">true</set>
         </condition>
       </progress>
    </search>
   ........
   .......
  </table>
</panel>

//2nd panel//

  <table>
    <search id="dms3">
      <query><somesearch> | fields ErrValidation</query>
      <earliest>-15m</earliest>
      <latest>now</latest>
      <sampleRatio>1</sampleRatio>
    </search>
    .........
    .........
  </table>
</panel>

//3rd Panel//

  <table>
    <search id="dms4">
      <query>|stats count</query>
      <earliest>-15m</earliest>
      <latest>now</latest>
      <sampleRatio>1</sampleRatio>
    </search>
    <option name="count">10</option>
    <option name="drilldown">cell</option>
    <option name="refresh.display">progressbar</option>
    <format type="color" field="Status">
      <colorPalette type="map">{"No Error":#FFFFFF}</colorPalette>
    </format>
  </table>
</panel>

0 Karma
1 Solution

vnravikumar
Champion

Hi

Check this sample, it will show third panel only if temp<=10 in 1st panel and errorcount =0 in second panel. I guess with this you can build your logic

<dashboard>
  <label>panel</label>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults |eval temp=10</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <done>
            <condition match="'result.temp'<=10">
              <set token="show1">true</set>
            </condition>
              <condition>
              <unset token="show1"></unset>
            </condition>
          </done>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults |eval errorcount=0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <done>
            <condition match="'result.errorcount'==&quot;0&quot;">
              <set token="show2">true</set>
            </condition>
            <condition>
             <unset token="show2"></unset>
            </condition>
          </done>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
  <row depends="$show1$,$show2$">
    <panel>
      <table>
        <search>
          <query>|makeresults |eval temp=0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
         </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</dashboard>

View solution in original post

vnravikumar
Champion

Hi

Check this sample, it will show third panel only if temp<=10 in 1st panel and errorcount =0 in second panel. I guess with this you can build your logic

<dashboard>
  <label>panel</label>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults |eval temp=10</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <done>
            <condition match="'result.temp'<=10">
              <set token="show1">true</set>
            </condition>
              <condition>
              <unset token="show1"></unset>
            </condition>
          </done>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults |eval errorcount=0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <done>
            <condition match="'result.errorcount'==&quot;0&quot;">
              <set token="show2">true</set>
            </condition>
            <condition>
             <unset token="show2"></unset>
            </condition>
          </done>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
  <row depends="$show1$,$show2$">
    <panel>
      <table>
        <search>
          <query>|makeresults |eval temp=0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
         </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</dashboard>

samjoshiacademi
Explorer

Thanx man !!! Big help 🙂

0 Karma

vnravikumar
Champion

Welcome 🙂

0 Karma
Get Updates on the Splunk Community!

This Week's Community Digest - Splunk Community Happenings [9.26.22]

Get the latest news and updates from the Splunk Community here! Upcoming User Group Events! &#x1f44f; Check ...

BSides Splunk 2022 - The Call for Papers is now Open!

TLDR; Main Site: https://bsidessplunk.com CFP Site: https://bsidessplunk.com/cfp CFP Opens: December 15th, ...

Sending Metrics to Splunk Enterprise With the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. The OpenTelemetry project is the second largest ...