Dashboards & Visualizations

How to write a condition or eval that compares the value after performing addition or subtraction in xml?

jonx10000
New Member

I want to set a token based on whether the value of the difference between two tokens is greater than a set value e.g:

<condition match="$secondToken$-$firstToken$>86400">
    <eval token="evalToken">$firstToken$+86400</eval>
</condition>
<condition>
    <eval token="evalToken">$firstToken$+1800</eval>
</condition>

The else condition works with no issue its the condition match that currently isn't working.

Tags (1)
0 Karma

cmerriman
Super Champion

i don't have any issues with this if i do <condition match="$secondToken$-$firstToken$&gt;86400">

just as a runanywhere dashboard to test:

<form script="showtokens.js">
  <label>test</label>
  <init>
    <set token="firstToken">1200</set>
    <set token="secondToken">96000</set>
  </init>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_internal|stats count by host</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <progress>
            <condition match="$secondToken$-$firstToken$>86400">
              <eval token="evalToken">$firstToken$+86400</eval>
            </condition>
            <condition>
              <eval token="evalToken">$firstToken$+1800</eval>
            </condition>
          </progress>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...