<?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: Using a time selector in a .dashboard - how can i make modifications to latest time in a query? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326011#M21063</link>
    <description>&lt;P&gt;So close - I think ive got it working we needed to modify the latest time to get the events to show the events i want .  Only mod made &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| makeresults | addinfo | eval latest=relative_time(info_max_time, "-1d") | table latest]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Going to test within dashboards now.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jun 2017 20:53:00 GMT</pubDate>
    <dc:creator>rvoninski_splun</dc:creator>
    <dc:date>2017-06-02T20:53:00Z</dc:date>
    <item>
      <title>Using a time selector in a .dashboard - how can i make modifications to latest time in a query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326008#M21060</link>
      <description>&lt;P&gt;I have a dashboard and set of queries where i want to give someone the ability to select the time range.  A time range isnt really as important as giving me the selection for latest time.  Since I am building queries based on that.  Specifically in the example below I want to only show the data for the day previous to the latest time selected in other words I want to make the time selection &lt;/P&gt;

&lt;P&gt;earliest=now-48hours(snap to day)&lt;BR /&gt;&lt;BR /&gt;
latest=now-24hours(snap to day)&lt;/P&gt;

&lt;P&gt;Here is the query I am trying to use but it isnt working as written.  The time token name is TimeRange&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;query&amp;gt;host=host123 index=security123 sourcetype="SplunkLog123" earliest=$TimeRange.latest$-2d@d latest=$TimeRange.latest$-1d@d&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for your help in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 19:08:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326008#M21060</guid>
      <dc:creator>rvoninski_splun</dc:creator>
      <dc:date>2017-06-02T19:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using a time selector in a .dashboard - how can i make modifications to latest time in a query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326009#M21061</link>
      <description>&lt;P&gt;You can set earliest/latest using a subsearch if necessary.  In this case, you can set earliest using an eval based on &lt;CODE&gt;info_max_time&lt;/CODE&gt;, created via &lt;CODE&gt;addinfo&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Try this, which should set &lt;CODE&gt;earliest&lt;/CODE&gt; to be essentially &lt;CODE&gt;latest-1d&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=host123 index=security123 sourcetype="SplunkLog123"  [| makeresults | addinfo | eval earliest=relative_time(info_max_time, "-1d") | table earliest]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Edit:&lt;/P&gt;

&lt;P&gt;Try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| makeresults | addinfo | eval earliest=relative_time(info_max_time, "-1d") | table earliest]  host=host123 index=security123 sourcetype="SplunkLog123"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've seen issues before with Splunk interpreting earliest=/latest= as key/values pairs of the data itself (instead of time modifiers) if they aren't at the start of the query.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 19:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326009#M21061</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-06-02T19:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using a time selector in a .dashboard - how can i make modifications to latest time in a query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326010#M21062</link>
      <description>&lt;P&gt;LOL - I should have just emailed you Micah!!  &lt;/P&gt;

&lt;P&gt;Im not quite getting this to work yet - the query is returning by itself from within splunk search no results when the subsearch is added.  by itself the subsearch is returning &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults  | addinfo | eval earliest=relative_time(info_max_time, "-1d") | table earliest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result a one element table with the following value --&amp;gt; 1496349788.000000 &lt;/P&gt;

&lt;P&gt;Any idea on what to check?  Have you been able to get this to run against your own queries with this subsearch?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;BR /&gt;
RV&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 20:44:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326010#M21062</guid>
      <dc:creator>rvoninski_splun</dc:creator>
      <dc:date>2017-06-02T20:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using a time selector in a .dashboard - how can i make modifications to latest time in a query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326011#M21063</link>
      <description>&lt;P&gt;So close - I think ive got it working we needed to modify the latest time to get the events to show the events i want .  Only mod made &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| makeresults | addinfo | eval latest=relative_time(info_max_time, "-1d") | table latest]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Going to test within dashboards now.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 20:53:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326011#M21063</guid>
      <dc:creator>rvoninski_splun</dc:creator>
      <dc:date>2017-06-02T20:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a time selector in a .dashboard - how can i make modifications to latest time in a query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326012#M21064</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;host=host123 index=security123 sourcetype="SplunkLog123" [|makeresults | earliest=$TimeRange.latest$-172800, latest=$TimeRange.latest$-86400| table earliest latest | format "" "" "" "" "" ""]&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Jun 2017 16:53:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-a-time-selector-in-a-dashboard-how-can-i-make/m-p/326012#M21064</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-03T16:53:42Z</dc:date>
    </item>
  </channel>
</rss>

