<?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: Earliest + |search doesn't work in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74229#M3990</link>
    <description>&lt;P&gt;It's getting more and more weird:&lt;BR /&gt;
|savedsearch "CPU Load By Type" earliest=-d&lt;BR /&gt;
works as expected, but when my form renders the template for the chart it simply drops the earliest altogether!&lt;BR /&gt;
I almost think I found a bug here...&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2013 05:26:25 GMT</pubDate>
    <dc:creator>gschmitz</dc:creator>
    <dc:date>2013-03-26T05:26:25Z</dc:date>
    <item>
      <title>Earliest + |search doesn't work</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74228#M3989</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I got some weird behavior with earliest. This one works just fine&lt;BR /&gt;
index=ci-x sourcetype=cpuByType earliest=-1d&lt;BR /&gt;
where as &lt;BR /&gt;
index=ci-x sourcetype=cpuByType |search earliest=-1d&lt;BR /&gt;
does not. From &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.1/SearchReference/Search#Time_options"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.1/SearchReference/Search#Time_options&lt;/A&gt;&lt;BR /&gt;
however I expected it to work.&lt;BR /&gt;
Can anybody share some light into this? &lt;/P&gt;

&lt;P&gt;The reason I want to do it this way is, that I want to accelerate some common stored search and show different ranges later in my charts. If you know a better way to achieve fast charts, please let me know &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 05:04:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74228#M3989</guid>
      <dc:creator>gschmitz</dc:creator>
      <dc:date>2013-03-26T05:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest + |search doesn't work</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74229#M3990</link>
      <description>&lt;P&gt;It's getting more and more weird:&lt;BR /&gt;
|savedsearch "CPU Load By Type" earliest=-d&lt;BR /&gt;
works as expected, but when my form renders the template for the chart it simply drops the earliest altogether!&lt;BR /&gt;
I almost think I found a bug here...&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 05:26:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74229#M3990</guid>
      <dc:creator>gschmitz</dc:creator>
      <dc:date>2013-03-26T05:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest + |search doesn't work</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74230#M3991</link>
      <description>&lt;P&gt;The ability to put &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; searchterms into the search clause feels very natural but it's kind of a backdoor.  Earliest and latest are technically separate API arguments, that you specify them separately from the searchstring.   Splunk allows you to put them into the search string, but it's more like it's doing you a favor.  And there are some limitations.  As you've found, they only work if they are in the initial search clause, but also you can't use them in boolean expressions like &lt;CODE&gt;(earliest=-1d latest=now) OR (earliest=-4d latest=-3d)&lt;/CODE&gt;.   And if you try such things splunkd will often ignore you. &lt;/P&gt;

&lt;P&gt;As to how you might filter by time outside of the first search clause, say for a situation where you have some existing scheduled search results and you want to apply postProcess logic to it, you can filter the rows by time by simply comparing the _time values using &lt;CODE&gt;search&lt;/CODE&gt; or &lt;CODE&gt;where&lt;/CODE&gt;.   Remember when you do this,  that _time may sometimes look and feel like a string-formatted time,  but it's actually an epochtime value, meaning it's just the number of seconds since 01/01/1970.  &lt;/P&gt;

&lt;P&gt;Here are some examples: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| where _time&amp;lt;relative_time(now(), "-1d@d")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| where _time&amp;lt;someOtherEpochTimeValuedField&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| where _time&amp;gt;relative_time(now(), "-4h") AND _time&amp;lt;relative_time(now(), "-2h")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 07:37:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74230#M3991</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-03-26T07:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest + |search doesn't work</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74231#M3992</link>
      <description>&lt;P&gt;Works for me. Didn't think about combining where with relative_time&lt;BR /&gt;
Note: you can also limit the results within the &lt;CHART&gt; and &amp;lt;table&amp;gt; elements in a form!&lt;/CHART&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 07:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Earliest-search-doesn-t-work/m-p/74231#M3992</guid>
      <dc:creator>gschmitz</dc:creator>
      <dc:date>2013-03-26T07:45:29Z</dc:date>
    </item>
  </channel>
</rss>

