<?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 How to parse outer search to get earliest and latest time range of subsearch? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517382#M145482</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to create a search the looks for specific signatures detected on the IPS and then returns all related firewall and proxy logs, grouped by each related set of events. I have written the following query. It is returning the correct results but taking hours to run and looks like the time fields are not being parsed to the outer search:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;
&lt;P&gt;(index=ips OR index=firewall OR index=proxy)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[search&amp;nbsp; index=ips signature_id&amp;nbsp; IN (25007, 25008,25009)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| eval earliest=_time-300&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| eval latest = _time+60&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| fields earliest latest src_ip]&lt;BR /&gt;transaction src_ip&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The search is run over 90days. The inner search completes after around 30sec and returns 6 results.&lt;BR /&gt;I am wanting to run the outer search for each of the six results (5min before the IPS event to 1min after).&lt;/P&gt;
&lt;P&gt;While the results a get are correct, the search took 10hrs to run. If I manually enter the earliest and latest and src_ip&amp;nbsp; into the following each result only takes around 2min:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;(index=ips OR index=firewall OR index=proxy) earliest=X latest=Y src_ip=Z&lt;BR /&gt;transaction src_ip&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I think the outer search is being run 6 times for either 'All Time' or 'Last 90days'. Can anyone assist me with getting the earliest and latest to parse so that it only runs the query on a 6min range for each result of the inner search?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Sep 2020 19:11:18 GMT</pubDate>
    <dc:creator>shay</dc:creator>
    <dc:date>2020-09-03T19:11:18Z</dc:date>
    <item>
      <title>How to parse outer search to get earliest and latest time range of subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517382#M145482</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to create a search the looks for specific signatures detected on the IPS and then returns all related firewall and proxy logs, grouped by each related set of events. I have written the following query. It is returning the correct results but taking hours to run and looks like the time fields are not being parsed to the outer search:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;
&lt;P&gt;(index=ips OR index=firewall OR index=proxy)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[search&amp;nbsp; index=ips signature_id&amp;nbsp; IN (25007, 25008,25009)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| eval earliest=_time-300&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| eval latest = _time+60&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| fields earliest latest src_ip]&lt;BR /&gt;transaction src_ip&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The search is run over 90days. The inner search completes after around 30sec and returns 6 results.&lt;BR /&gt;I am wanting to run the outer search for each of the six results (5min before the IPS event to 1min after).&lt;/P&gt;
&lt;P&gt;While the results a get are correct, the search took 10hrs to run. If I manually enter the earliest and latest and src_ip&amp;nbsp; into the following each result only takes around 2min:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;(index=ips OR index=firewall OR index=proxy) earliest=X latest=Y src_ip=Z&lt;BR /&gt;transaction src_ip&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I think the outer search is being run 6 times for either 'All Time' or 'Last 90days'. Can anyone assist me with getting the earliest and latest to parse so that it only runs the query on a 6min range for each result of the inner search?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 19:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517382#M145482</guid>
      <dc:creator>shay</dc:creator>
      <dc:date>2020-09-03T19:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest and Latest not parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517407#M145493</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=firewall OR index=proxy 
    [ search index=ips signature_id IN (25007, 25008,25009) 
        [| gentimes start=-1 
        | addinfo 
        | eval earliest=info_min_time-300,latest=info_max_time+60 
        | table earliest,latest] 
    | stats count by src_ip 
    | table src_ip
        ]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Sep 2020 07:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517407#M145493</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-02T07:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest and Latest not parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517603#M145562</link>
      <description>&lt;P&gt;Thanks for your reply&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Unfortunately that isn't working. It is still taking many hours to run and now it returns 1000s of results. Results that do not match the times of the subsearch. It appears to be pulling the all the logs relating to any of the IPs from the last 90days.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 23:54:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517603#M145562</guid>
      <dc:creator>shay</dc:creator>
      <dc:date>2020-09-02T23:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest and Latest not parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517777#M145616</link>
      <description>&lt;P&gt;yes, inner search takes time range from time range you chosen in time range picker.&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example , if you choose last 90 days, inner search earliest time would be 90days-300seconds and latest time would now()+60 seconds.&lt;/P&gt;&lt;P&gt;I read your question properly understand that you want to pass different times based on your inner search results. is that right ?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 17:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517777#M145616</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-03T17:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest and Latest not parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517783#M145618</link>
      <description>Can you try to get only&lt;BR /&gt;“| stats earliest_time(_time) as earliest latest_time(_time) as latest values(src_ip) “&lt;BR /&gt;from the Inner loop instead of those six separate earliest and latest?</description>
      <pubDate>Thu, 03 Sep 2020 18:08:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-outer-search-to-get-earliest-and-latest-time-range/m-p/517783#M145618</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-09-03T18:08:32Z</dc:date>
    </item>
  </channel>
</rss>

