<?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: How to use the same timerange for both the main search and subsearch in Splunk 6.3? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259318#M77749</link>
    <description>&lt;P&gt;I'm just trying to get a good answer for you here, but ÇI don't know if I'm right. &lt;/P&gt;

&lt;P&gt;Can you try this and tell if it works? I want to advise you that maybe I didn't get the consult yet, but I'm trying.&lt;/P&gt;

&lt;P&gt;sourcetype=a event!=by | join type=left eventId [search sourcetype=a event=b]&lt;/P&gt;

&lt;P&gt;just notice that in the sql code you wrote event=by in () and in the splunk search event=b in [], so I just change the splunk part code for this part and wrote  event!=by&lt;/P&gt;

&lt;P&gt;If I missing something just answer again and I will keep trying &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Feb 2016 10:12:33 GMT</pubDate>
    <dc:creator>marina_rovira</dc:creator>
    <dc:date>2016-02-02T10:12:33Z</dc:date>
    <item>
      <title>How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259312#M77743</link>
      <description>&lt;P&gt;Is it possible to make exactly the same timerange for the search and the subsearch in Splunk 6.3?&lt;/P&gt;

&lt;P&gt;For example a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a event=b NOT [search sourcetype=a event=b | fields eventId]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(eventId is unique for every event, for example)&lt;BR /&gt;
returns some results in the end of the time window. So, Splunk doesn't find them from a subsearch, but found from the main search.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Edited :&lt;/P&gt;

&lt;P&gt;Latest&amp;amp;Earliest is a good idea, but what if I want to run a search on a schedule? The only latest I can imagine is "now" and it's the default one.&lt;/P&gt;

&lt;P&gt;I can set &lt;CODE&gt;latest=-1m&lt;/CODE&gt; in search and it will solve the problem, but it is a very bad solution.&lt;/P&gt;

&lt;P&gt;Is there any other ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 10:37:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259312#M77743</guid>
      <dc:creator>0range</dc:creator>
      <dc:date>2016-02-01T10:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259313#M77744</link>
      <description>&lt;P&gt;Hi there, the subsearch, negating it, is the opposite of the search. It is right?&lt;BR /&gt;
Because the, maybe is because of this it shows only the results from the search.&lt;/P&gt;

&lt;P&gt;Maybe I'm miss understanding something, let me know if it's the case.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 10:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259313#M77744</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-02-01T10:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259314#M77745</link>
      <description>&lt;P&gt;Something quick and dirty but it works fine using "earliest" and "latest":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a event=b earliest=ABC latest=DEF NOT [search sourcetype=a event=b earliest=ABC latest=DEF| fields eventId]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Feb 2016 10:48:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259314#M77745</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-01T10:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259315#M77746</link>
      <description>&lt;P&gt;you just use the same &lt;CODE&gt;Earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; in the sub-search and main search.&lt;/P&gt;

&lt;P&gt;For more informations about earliest and latest, follow this link:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/SearchTimeModifiers"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/SearchTimeModifiers&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 11:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259315#M77746</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2016-02-01T11:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259316#M77747</link>
      <description>&lt;P&gt;It shows only result from search, but the ara filtered due to subsearch conditions. And the filtering works wrong.&lt;/P&gt;

&lt;P&gt;I want to implement an SQL code&lt;BR /&gt;
&lt;CODE&gt;select * from a &lt;BR /&gt;
where event=b&lt;BR /&gt;
and eventId not in&lt;BR /&gt;
(select eventId from a where event=by)&lt;/CODE&gt;&lt;BR /&gt;
in SPL. It looks like this&lt;BR /&gt;
&lt;CODE&gt;sourcetype=a event=b NOT [search sourcetype=a event=b | fields eventId]&lt;/CODE&gt;&lt;BR /&gt;
but it is not EXACTLY the same. &lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 13:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259316#M77747</guid>
      <dc:creator>0range</dc:creator>
      <dc:date>2016-02-01T13:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259317#M77748</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I don't fully understand your comment above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Latest&amp;amp;Earliest is a good idea, but if I want to run search on a schedule? the only latest I can imagine is "now" and it's the default one.

I can set latest=-1m in search and it will solved the problem, but it is a very bad solution.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your latest and earliest will work in same way when you are running a scheduled search. If you don't specify latest it'll be the same as latest=now as you said before.&lt;/P&gt;

&lt;P&gt;Just to give you an example, I ran certain scheduled searches every 15 minutes and I want them to run with that frequency so I round the seconds to the closest minute using @:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=ABC earliest=-15m@m latest=@m [| searchsomethingelse earliest=-15m@m latest=@m]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure if that answers your question though.&lt;/P&gt;

&lt;P&gt;Another option is to return earliest and latest from your subsearch. For instance:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a event=b NOT [
    search sourcetype=a event=b earliest=ABC latest=DEF
    | rename _time AS earliest
    | eval latest=earliest + (60 * x)
    | fields eventId, earliest, latest
] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Feb 2016 13:56:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259317#M77748</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-01T13:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the same timerange for both the main search and subsearch in Splunk 6.3?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259318#M77749</link>
      <description>&lt;P&gt;I'm just trying to get a good answer for you here, but ÇI don't know if I'm right. &lt;/P&gt;

&lt;P&gt;Can you try this and tell if it works? I want to advise you that maybe I didn't get the consult yet, but I'm trying.&lt;/P&gt;

&lt;P&gt;sourcetype=a event!=by | join type=left eventId [search sourcetype=a event=b]&lt;/P&gt;

&lt;P&gt;just notice that in the sql code you wrote event=by in () and in the splunk search event=b in [], so I just change the splunk part code for this part and wrote  event!=by&lt;/P&gt;

&lt;P&gt;If I missing something just answer again and I will keep trying &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 10:12:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-same-timerange-for-both-the-main-search-and/m-p/259318#M77749</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-02-02T10:12:33Z</dc:date>
    </item>
  </channel>
</rss>

