I have a file that keeps a 30 day average of values, which does not have a date field in it. Splunk is getting the date from the day the file was created, but this means the data is a day old, which is correct. However, I have a dashboard with multiple panels and a time picker which is thrown off by this. For example, the default is yesterday. The time token reflects this, and the search uses that value to look for data. But then the data it finds for yesterday is actually two days old. So, I want the search to use today's file to find yesterday's data, which I tried to accomplish by adding one day to the time token with one day added:
<earliest>$field1.earliest$+1d</earliest>
<latest>latest+1d</latest>
and the eval command:
|eval latest=case($field1.latest$ == now, "@d", 1==1, "$field1.latest$")
This was supposed to (in my mind) point the search to the file created the day after the day which was requested, giving the illusion of reading in the correct data for the date which was input by the user. This seems to be fine except where the latest time is 'now', in which case I get the error message:
Invalid latest_time: latest_time must be after earliest_time.
I tried using the actual token ($field1.earliest$) in place of my 'latest' field for <latestTime>, and I get the message:
Error in 'eval' command: The expression is malformed. An unexpected character is reached at '@d == now, "@d", 1==1, "@d")'.
which I think means the actual eval case statement is broken. Maybe eval can't use things like '@d' as parameters?
Any ideas on how I can read in the data for the day the dashboard user picked? So if the date July 6th is chosen, that would be data from the file created on July 7th, etc.
... View more