Dashboards & Visualizations

How can I check to see if a token is unset before setting it; essentially using the same link to set/unset a token?

toutla
Explorer

I am trying to use the same drilldown link to toggle the function of setting and unsetting the same token.  

 

Current Code

<drilldown>
   <condition>
      <set token="arrangements_details">true</set>
    </condition>
</drilldown>

 

The idea - just need correct syntax

<drilldown>
   <condition match="$arrangements_details$=null">
      <set token="arrangements_details">true</set>
    </condition>

   <condition match="$arrangements_details$=true">
      <unset token="arrangements_details">true</unset>
    </condition>
</drilldown>

 

Any suggestions?

0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

I'm guessing this is about using dependent panels. There are a couple of problems in your match statement

1. Using = null - use isnull()

2. = true must be quoted with &quot;

See this

<dashboard>
  <label>Click Toggle</label>
  <row>
    <panel>
      <table>
        <search>
          <query>
            index=_internal earliest=-5s
            | stats count by _time
          </query>
        </search>
        <drilldown>
          <condition match="isnull($arrangements_details$)">
            <set token="arrangements_details">true</set>
          </condition>
          <condition match="$arrangements_details$=&quot;true&quot;">
            <unset token="arrangements_details">true</unset>
          </condition>
        </drilldown>
      </table>
    </panel>
    <panel depends="$arrangements_details$">
      <table>
        <title>arrangements_details=$arrangements_details$</title>
        <search>
          <query>
            | makeresults
            | eval Drilldown="Clicked"
            | table Drilldown
          </query>
        </search>
      </table>
    </panel>
  </row>
</dashboard>

Hope this helps

 

View solution in original post

0 Karma

bowesmana
SplunkTrust
SplunkTrust

I'm guessing this is about using dependent panels. There are a couple of problems in your match statement

1. Using = null - use isnull()

2. = true must be quoted with &quot;

See this

<dashboard>
  <label>Click Toggle</label>
  <row>
    <panel>
      <table>
        <search>
          <query>
            index=_internal earliest=-5s
            | stats count by _time
          </query>
        </search>
        <drilldown>
          <condition match="isnull($arrangements_details$)">
            <set token="arrangements_details">true</set>
          </condition>
          <condition match="$arrangements_details$=&quot;true&quot;">
            <unset token="arrangements_details">true</unset>
          </condition>
        </drilldown>
      </table>
    </panel>
    <panel depends="$arrangements_details$">
      <table>
        <title>arrangements_details=$arrangements_details$</title>
        <search>
          <query>
            | makeresults
            | eval Drilldown="Clicked"
            | table Drilldown
          </query>
        </search>
      </table>
    </panel>
  </row>
</dashboard>

Hope this helps

 

0 Karma

toutla
Explorer

That worked perfectly, thank you!!!

0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...