Dashboards & Visualizations

Dashboard search "eval" token returns wrong result, same code gets right answer when run in search window

gabriel_vasseur
Contributor

In my dashboard:

<dashboard>
  <label>...</label>
  <search id="basesearch">
    <query>...</query>
    <earliest>-7d@w1</earliest>
    <latest>@w1</latest>
    <preview>
      <eval token="earliest_token">$job.request.earliest_time$</eval>
      <eval token="earliest_token2">strftime( relative_time( now(), $job.request.earliest_time$ ), "%d/%m/%Y %H:%M" )</eval>
    </preview>
  </search>
  <row>
    <panel depends="$earliest_token$">
      <html>
        <p>Earliest $earliest_token$ converts to $earliest_token2$</p>
      </html>
    </panel>
  </row>
  ...

This displays:

Earliest -7d@w1 converts to 05/07/2016 00:00

Which is wrong: It should be the 4th of July. The other panels in the dashboard, all fed by the base search, are indeed showing data starting from the 4th of July. And if I run this in a regular search window:

| stats count | eval count=strftime( relative_time( now(), "-7d@w1" ), "%c" )

I get the right result:

Mon Jul 4 00:00:00 2016

So why is my dashboard eval lying?

dajomas
Path Finder

@gabriel_vasseur did you ever get this issue fixed? My dashboard just started to show the same issue after it ran ok for over a week. (Running Splunk 9.0.0)

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This does look like a defect that has been re-introduced with 9.0.0. Please raise a ticket with your  support team.

Having said that, it appears to be a problem for tokens not for SPL in dashboards. Can you work around it by modifying your search queries?

0 Karma

dajomas
Path Finder

Unfortunately, there is this weird thing, where it DOES work on my mobile but not on my laptop (using Chrome)

 

Thing is, I use a drilldown in a bar graph to set the year and month for another bar graph (first bargraph is a monthly total for a given year, second bar graph is a daily total for a given month. When you click on a specific month, it shoul show that month in the second bar graph, but it show a month earlier. Same for a third graph that shows a specific day, which you can select by clicking on a date in the second bargraph.)

Now, when I open the search in a separate window and I add the exact same evals which are used in the dropdown, the correct values are shown. But when I click in the graph, the wrong values are used (the values from 1 bar to the left)

0 Karma

sundareshr
Legend

I just test this, & I get Earliest -7d@w1 converts to 04/07/2016 00:00

<dashboard>
   <label>...</label>
   <search id="basesearch">
     <query>index=_internal | head 1</query>
     <earliest>-7d@w1</earliest>
     <latest>@w1</latest>
     <preview>
       <eval token="earliest_token">$job.request.earliest_time$</eval>
       <eval token="earliest_token2">strftime( relative_time( now(), $job.request.earliest_time$ ), "%d/%m/%Y %H:%M" )</eval>
     </preview>
   </search>
   <row>
     <panel depends="$earliest_token$">
       <html>
         <p>Earliest $earliest_token$ converts to $earliest_token2$</p>
       </html>
     </panel>
   </row>
</dashboard>
0 Karma

gabriel_vasseur
Contributor

I can't see any difference in your code, compared to mine, so I'm guessing what you're saying is "WFM"? 😞

0 Karma

sundareshr
Legend

I copied your code 🙂

0 Karma
Get Updates on the Splunk Community!

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureThursday, March 27, 2025  |  11AM PST / 2PM EST | Register NowStep boldly ...

Splunk AppDynamics with Cisco Secure Application

Web applications unfortunately present a target rich environment for security vulnerabilities and attacks. ...