<?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: Set earliest and latest dynamically in simple XML in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232051#M14391</link>
    <description>&lt;P&gt;Thanks, that fixed it!&lt;BR /&gt;
It's confusing that the docs state "For exact time ranges, the syntax of time_modifier is: %m/%d/%Y:%H:%M:%S.". Not only do epoch time stamps also work in searches but apparently they MUST be used in simple XML.&lt;/P&gt;</description>
    <pubDate>Fri, 06 May 2016 07:55:00 GMT</pubDate>
    <dc:creator>gabriel_vasseur</dc:creator>
    <dc:date>2016-05-06T07:55:00Z</dc:date>
    <item>
      <title>Set earliest and latest dynamically in simple XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232049#M14389</link>
      <description>&lt;P&gt;I have a custom form where the user can select a month. The label (i.e. what the user sees) is the month name. Because the list of choices are generated by a dynamic search I can easily control the value (i.e. what the token gets set to) to be either the month name, number, the timestamp of the start of the month, etc. The question is how to use that token to specify both the earliest and latest in my base search?&lt;/P&gt;

&lt;P&gt;This is a condensed version of how far I got:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  ...
  &amp;lt;input token="monthEarliest"&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;... | eval month_name=strftime( starttime, "%B" )
      | eval month_earliest=strftime(starttime, "%m/%d/%Y:%H:%M:%S")
      | eval month_latest=strftime(relative_time(starttime,"+1mon"), "%m/%d/%Y:%H:%M:%S")&amp;lt;/query&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;fieldForLabel&amp;gt;month_name&amp;lt;/fieldForLabel&amp;gt;
    &amp;lt;fieldForValue&amp;gt;month_earliest&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;change&amp;gt;
      &amp;lt;set token="monthLatest"&amp;gt;$row.month_latest$&amp;lt;/set&amp;gt;
    &amp;lt;/change&amp;gt;
  &amp;lt;/input&amp;gt;
...
  &amp;lt;search id="my_main_search"&amp;gt;
    &amp;lt;query&amp;gt;...&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;$monthEarliest$&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;$monthLatest$&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
...
&amp;lt;/form&amp;gt;      
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However this gives me "invalid earliest time".&lt;BR /&gt;
I have printed the value of $monthEarliest$ and $monthLatest$ and they look alright and get updated correctly when changing the dropdown. Also, they work as expect if I use them in a manual search outside the dashboard, as they should as per &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.3/Search/Specifytimemodifiersinyoursearch"&gt;the docs&lt;/A&gt;. So I have no idea why in the dashboard they wouldn't work as well.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 15:11:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232049#M14389</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-05-05T15:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set earliest and latest dynamically in simple XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232050#M14390</link>
      <description>&lt;P&gt;You have to convert &lt;CODE&gt;$monthEarliest$&lt;/CODE&gt; and &lt;CODE&gt;$monthLatest$&lt;/CODE&gt; to Unix Epoch time (a &lt;CODE&gt;time_t&lt;/CODE&gt; which is an integer, not a string).&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 16:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232050#M14390</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-05-05T16:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Set earliest and latest dynamically in simple XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232051#M14391</link>
      <description>&lt;P&gt;Thanks, that fixed it!&lt;BR /&gt;
It's confusing that the docs state "For exact time ranges, the syntax of time_modifier is: %m/%d/%Y:%H:%M:%S.". Not only do epoch time stamps also work in searches but apparently they MUST be used in simple XML.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 07:55:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Set-earliest-and-latest-dynamically-in-simple-XML/m-p/232051#M14391</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-05-06T07:55:00Z</dc:date>
    </item>
  </channel>
</rss>

