<?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: Best approach for using a sub-search to compare time frames in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252364#M75508</link>
    <description>&lt;P&gt;Try this change to your query&lt;/P&gt;

&lt;P&gt;You now have&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| chart count over x by month
| fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Change this to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(month) as months by x
| where mvcount(months)=2
| fields - months
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Sep 2016 16:26:30 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-09-22T16:26:30Z</dc:date>
    <item>
      <title>Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252352#M75496</link>
      <description>&lt;P&gt;I am looking for the most efficient way to do a sub search to see if vulnerabilities still exist now  vs 90 days.&lt;/P&gt;

&lt;P&gt;Currently I do a search from 90 days back and spit that file to a csv and then do a lookup and pass those to the search but want to automate this process instead of constantly updating a lookup file. I have listed the base search below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network sourcetype=nessus severity!=informational 
|  dedup signature_id, dest_dns  ]
|  dedup signature_id, dest_dns 
| eval hostnamesplit=split(dest_dns,".") 
| eval hostnamesplit=mvindex(hostnamesplit,0)
| lookup AssetTag.csv Asset as hostnamesplit OUTPUT BusinessUnit1 System1
| eval Combo=mvzip(BusinessUnit1, System1) 
| fields - System1, BusinessUnit1  
| mvexpand Combo 
| makemv Combo delim="," 
| eval BU1=mvindex(Combo,0) 
| eval Sys1=mvindex(Combo,1) 
| fields - Combo
| dedup hostnamesplit signature_id BU1 Sys1
| table BU1 signature Sys1 dest_dns severity 
|  rename  Sys1 AS "System", signature AS "Signature", BU1 AS "Business Unit",dest_dns as "Host" severity as "Severity"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Aug 2016 02:39:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252352#M75496</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-08-27T02:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252353#M75497</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;You could use the outputlookup command to automate the refresh of the lookup. Schedule this query at midnight everyday, for the past 90 days:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"your base query that list all the vulnerabilities" | outputlookup AssetTag.csv 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then, the rest of the logic of your query will continue beign valid&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 12:20:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252353#M75497</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2016-08-29T12:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252354#M75498</link>
      <description>&lt;P&gt;The AssetTag.csv is how I map systems to Business Units. Nothing is kept track inside that csv about scanned vulnerabilities. Basically I just want to take a search from today and check to see if they still existed 90 days ago to track how effective our patching currently is. &lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252354#M75498</guid>
      <dc:creator>trevorr2004</dc:creator>
      <dc:date>2016-08-29T13:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252355#M75499</link>
      <description>&lt;P&gt;Ok, my mistake. But the solution is the same. Schedule the 90 days vulnerabilities query and dump the results to a lookup, and then in your actual search use the lookup to perform the comparison. It will be much better than running a 90 days subsearch everytime you need to run the main search&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252355#M75499</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2016-08-29T13:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252356#M75500</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network sourcetype=nessus severity!=informational (earliest=-90d@d latest=-90d@d+1d) OR (earliest=@d) 
 |  dedup signature_id, dest_dns  ]
 |  dedup signature_id, dest_dns 
 | eval hostnamesplit=split(dest_dns,".") 
 | eval hostnamesplit=mvindex(hostnamesplit,0)
 | lookup AssetTag.csv Asset as hostnamesplit OUTPUT BusinessUnit1 System1
 | eval Combo=mvzip(BusinessUnit1, System1) 
 | fields - System1, BusinessUnit1  
 | mvexpand Combo 
 | makemv Combo delim="," 
 | eval BU1=mvindex(Combo,0) 
 | eval Sys1=mvindex(Combo,1) 
 | fields - Combo
 | dedup hostnamesplit signature_id BU1 Sys1
 | eval month=strftime(_time, "%b")
 | eval x=BU1."^".signature."^".Sys1."^".dest_dns."^".severity
 | chart count over x by month
 | fields - count
 | rex field=x (?&amp;lt;BU1&amp;gt;[^\^]+)\^(?&amp;lt;signature&amp;gt;[^\^]+)\^(?&amp;lt;Sys1&amp;gt;[^\^]+)\^(?&amp;lt;dest_dns&amp;gt;[^\^]+)\^(?&amp;lt;severity&amp;gt;[^\^]+)
 |  rename  Sys1 AS "System", signature AS "Signature", BU1 AS "Business Unit",dest_dns as "Host" severity as "Severity"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:27:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252356#M75500</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-29T13:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252357#M75501</link>
      <description>&lt;P&gt;Error in 'SearchParser': Missing a search command before '^'. Error at position '791' &lt;/P&gt;

&lt;P&gt;I also had a rogue ] in the search &lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252357#M75501</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-08-29T13:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252358#M75502</link>
      <description>&lt;P&gt;Missing quotes in the &lt;CODE&gt;rex&lt;/CODE&gt; command. Make this change&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=x "(?&amp;lt;BU1&amp;gt;[^\^]+)\^(?&amp;lt;signature&amp;gt;[^\^]+)\^(?&amp;lt;Sys1&amp;gt;[^\^]+)\^(?&amp;lt;dest_dns&amp;gt;[^\^]+)\^(?&amp;lt;severity&amp;gt;[^\^]+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252358#M75502</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-29T13:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252359#M75503</link>
      <description>&lt;P&gt;Does this compare the two time frames in the initial search? So basically this should return anything that was found today that also was found 90 days ago.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:38:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252359#M75503</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-08-29T14:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252360#M75504</link>
      <description>&lt;P&gt;That's correct. &lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:40:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252360#M75504</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-29T14:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252361#M75505</link>
      <description>&lt;P&gt;Say that our scan results are dumped in over periods of time so not just one month. Am I able to do something like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=network sourcetype=nessus severity!=informational dest_dns=hqw0prd1rebs61.ent.pbgc.gov (earliest=-120d@d latest=-90d@d+1d) OR (earliest=-30d@d latest=@d)   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sorry for the late response, revisiting this subject and running into a few issues. &lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 15:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252361#M75505</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-09-22T15:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252362#M75506</link>
      <description>&lt;P&gt;I have also noticed that its not making sure that events were found in both time ranges. For instance, It's displaying results that were found in June but if I do a separate search, that signature doesn't show up in the past 30 days. Any other suggestions on how to resolve the issue?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 15:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252362#M75506</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-09-22T15:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252363#M75507</link>
      <description>&lt;P&gt;Yes, you can use that timeframe.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 16:21:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252363#M75507</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-22T16:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252364#M75508</link>
      <description>&lt;P&gt;Try this change to your query&lt;/P&gt;

&lt;P&gt;You now have&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| chart count over x by month
| fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Change this to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(month) as months by x
| where mvcount(months)=2
| fields - months
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Sep 2016 16:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252364#M75508</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-22T16:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252365#M75509</link>
      <description>&lt;P&gt;I get under the statistics, no results found when I made the selected changes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=network sourcetype=nessus severity!=informational (earliest=-120d@d latest=-90d@d+1d) OR (latest=-30d@d earliest=@d) dest_dns=hqw0prd1rebs61.ent.pbgc.gov
  | dedup signature_id, dest_dns  
  | eval hostnamesplit=split(dest_dns,".") 
  | eval hostnamesplit=mvindex(hostnamesplit,0)
  | lookup AssetTag.csv Asset as hostnamesplit OUTPUT BusinessUnit1 System1
  | eval Combo=mvzip(BusinessUnit1, System1) 
  | fields - System1, BusinessUnit1  
  | mvexpand Combo 
  | makemv Combo delim="," 
  | eval BU1=mvindex(Combo,0) 
  | eval Sys1=mvindex(Combo,1) 
  | fields - Combo  
  | dedup hostnamesplit signature_id BU1 Sys1 | eval x=BU1."^".signature."^".Sys1."^".dest_dns."^".severity   | rex field=x "(?&amp;lt;BU1&amp;gt;[^\^]+)\^(?&amp;lt;signature&amp;gt;[^\^]+)\^(?&amp;lt;Sys1&amp;gt;[^\^]+)\^(?&amp;lt;dest_dns&amp;gt;[^\^]+)\^(?&amp;lt;severity&amp;gt;[^\^]+)"   
 | stats values(month) as months by x
 | where mvcount(months)=2
 | fields - months
 |  rename  Sys1 AS "System", signature AS "Signature", BU1 AS "Business Unit",dest_dns as "Host" severity as "Severity"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is what my query is as of now. &lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 16:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252365#M75509</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-09-22T16:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Best approach for using a sub-search to compare time frames</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252366#M75510</link>
      <description>&lt;P&gt;Was able to get it working perfectly. Thanks again for all of your help sundareshr.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 18:04:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Best-approach-for-using-a-sub-search-to-compare-time-frames/m-p/252366#M75510</guid>
      <dc:creator>trevorQmulos</dc:creator>
      <dc:date>2016-09-23T18:04:18Z</dc:date>
    </item>
  </channel>
</rss>

