Dashboards & Visualizations

How to remove timezone from job.latestTime and job.earliestTime token?

BakaFon
Loves-to-Learn Everything

I need to add a line that show the number of results I get in the timeframe of the dashboard search using the job.earliestTime and job.latestTime tokens but if I use the replace function it doesn't work.

This is the code of the dashboard I used:

 

 

<html>
          <div class="custom-result-value">Results: $result$ in the time frame ($stime$ a $ltime$)</div>
        </html>
      <table id="test_table">
        <search>
          <query>| metadata type=sources | eval lastTime=strftime(lastTime, "%Y-%m-%d %H:%M:%S.%Q"), firstTime=strftime(firstTime, "%Y-%m-%d %H:%M:%S.%Q"), recentTime=strftime(recentTime, "%Y-%m-%d %H:%M:%S.%Q")</query>
          <earliest>-365d@d</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
          <progress>
            <eval token="result">tonumber('job.resultCount')</eval>
            <eval token="ltime">tostring('job.latestTime')</eval>
            <eval token="stime">tostring('job.earliestTime')</eval>
            <eval token="stime">replace('$stime$',"\+\d+:00","")</eval>
            <eval token="stime">replace('$ltime$',"\+\d+:00","")</eval>
          </progress>
        </search>
        <option name="count">10</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">true</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>

 

 

I get this regardless or not i use the replace command

BakaFon_0-1644327212342.png

The replace command works if used in a regular search

BakaFon_1-1644327699104.png

 

Labels (2)
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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