<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamically add a day to latest time? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149536#M9066</link>
    <description>&lt;P&gt;Check the relevant part of your macros.conf if it looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[relative_time(2)]
args = time,relative
definition = relative_time($time$, "$relative$")
iseval = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also make sure you have the appropriate backticks around the macro call:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... latest=`relative_time($early$, "+d")` ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Jul 2014 19:51:24 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-07-18T19:51:24Z</dc:date>
    <item>
      <title>Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149532#M9062</link>
      <description>&lt;P&gt;I am changing the Simple XML for a drilldown to go to another panel on my dashboard.&lt;BR /&gt;
Currently there is a linegraph and you can click on any point to see more information about it, but I want to bring the dates with it. I can easily set the earliest date to the date that is on the chart, but obviously if I also set the latest date as the same date on the chart, nothing will show up, because Splunk includes the time in the date as well.&lt;/P&gt;

&lt;P&gt;So the drilldown XML code looks like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;drilldown&amp;gt;
    &amp;lt;link&amp;gt;
      &amp;lt;![CDATA[ request_stats?form.sourcetype=$click.name2$&amp;amp;early=$click.value$&amp;amp;form.team=$team$&amp;amp;form.app=$app$ ]]&amp;gt;
    &amp;lt;/link&amp;gt;
  &amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the search I'm running takes in the time like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Name" = "$form.sourcetype$" earliest=$early$ [search "AppName" = "Master" "Status" = "500" | fields + ContextId]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I want to enter the latest time as something like latest=earliest+1d&lt;BR /&gt;
With the idea in mind that if earliest is set to July 18th 2014 at midnight, then latest would be set to July 19th 2014 at midnight&lt;/P&gt;

&lt;P&gt;Or if I could set it in the URL for the drilldown, I just don't know how to do either. Feel free to ask a question for clarification on what I said above&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 18:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149532#M9062</guid>
      <dc:creator>dreamwork801</dc:creator>
      <dc:date>2014-07-18T18:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149533#M9063</link>
      <description>&lt;P&gt;You could do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Name="$form.sourcetype$" earliest=$early$ latest=`relative_time($early$, "+d")` [search AppName="Master" Status=500 | fields ContextId]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That's an eval-based macro (Settings -&amp;gt; Advanced Search -&amp;gt; Macros) you need to define as &lt;CODE&gt;relative_time(2)&lt;/CODE&gt; with two parameters &lt;CODE&gt;time,relative&lt;/CODE&gt; and this body:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; relative_time($time$, "$relative$")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jul 2014 19:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149533#M9063</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-07-18T19:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149534#M9064</link>
      <description>&lt;P&gt;I'm getting an invalid value "relative_time" for time term 'latest'&lt;/P&gt;

&lt;P&gt;I put relative_time(2) as the name&lt;BR /&gt;
I put time,relative as arguments (it wouldn't let me use $ signs)&lt;BR /&gt;
I put relative_time($time$, "$relative$") in the definition&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149534#M9064</guid>
      <dc:creator>dreamwork801</dc:creator>
      <dc:date>2020-09-28T17:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149535#M9065</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Name="$form.sourcetype$" earliest=$early$ latest=[|gentimes start=-1 | eval t=relative_time($early$,"+d")| return $t][search AppName="Master" Status=500 | fields ContextId]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jul 2014 19:47:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149535#M9065</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-18T19:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149536#M9066</link>
      <description>&lt;P&gt;Check the relevant part of your macros.conf if it looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[relative_time(2)]
args = time,relative
definition = relative_time($time$, "$relative$")
iseval = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also make sure you have the appropriate backticks around the macro call:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... latest=`relative_time($early$, "+d")` ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jul 2014 19:51:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149536#M9066</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-07-18T19:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149537#M9067</link>
      <description>&lt;P&gt;That &lt;CODE&gt;$t&lt;/CODE&gt; may throw off the dashboard, you'll need to escape it with another dollar sign.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 19:52:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149537#M9067</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-07-18T19:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149538#M9068</link>
      <description>&lt;P&gt;That worked perfectly! Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 20:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149538#M9068</guid>
      <dc:creator>dreamwork801</dc:creator>
      <dc:date>2014-07-18T20:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically add a day to latest time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149539#M9069</link>
      <description>&lt;P&gt;You should take a look at getting the macro to work - it'll be miles faster than launching an entire subsearch just to do a tiny calculation.&lt;/P&gt;

&lt;P&gt;You know the search for &lt;CODE&gt;AppName="Master"&lt;/CODE&gt; isn't affected by the outer &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt;, right?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 22:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamically-add-a-day-to-latest-time/m-p/149539#M9069</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-07-18T22:58:33Z</dc:date>
    </item>
  </channel>
</rss>

