<?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: Subsearch - how to search based on results of first search (e.g. foreach) in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530964#M4291</link>
    <description>&lt;LI-CODE lang="markup"&gt;index=qualys QID=48118 AND "WebLogic RCE - CVE-2020-14882"
| stats latest(_time) as _time values(DNS) as DNS values(RESULTS) as RESULTS by IP
| table _time IP DNS RESULTS&lt;/LI-CODE&gt;&lt;P&gt;In those conditions, this would be fine.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Nov 2020 08:18:29 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-11-26T08:18:29Z</dc:date>
    <item>
      <title>Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530638#M4255</link>
      <description>&lt;P&gt;What is typically the best way to do splunk searches that following logic.&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;First Search (get list of hosts)&lt;/LI&gt;&lt;LI&gt;Get Results&lt;/LI&gt;&lt;LI&gt;Second Search (For each result perform another search, such as find list of vulnerabilities&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My example is searching Qualys Vulnerability Data.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Searching HTTP Headers first and including Tag results in search query&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=qualys QID=48118
[search index=qualys "WebLogic RCE - CVE-2020-14882"
| dedup IP
| table IP]
| stats latest(_time) values(DNS) values(RESULTS) by IP&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue with this search is that it doesn’t include systems with the RCE tag but no QID=48118 (HTTP Headers Data)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Searching TAG first then Join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=qualys "WebLogic RCE - CVE-2020-14882"
| dedup IP
| table IP, DNS
| join type=left IP
[search index=qualys QID=48118
| dedup IP RESULTS]
| stats values(DNS), values(RESULTS) by IP&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue here is that I only get back one HTTP RESULT, there should be a few for each port that is open.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any links to the best way to create subsearches from results would be great for learning.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 16:11:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530638#M4255</guid>
      <dc:creator>mag314</dc:creator>
      <dc:date>2020-11-24T16:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530682#M4266</link>
      <description>&lt;P&gt;The first search looks like it should work, but with some minor changes.&amp;nbsp; When working with subsearches it helps to run the subsearch by itself with &lt;FONT face="courier new,courier"&gt;| format&lt;/FONT&gt; added to see what exactly is returned to the main search.&amp;nbsp; Once you've adjusted the result of the subsearch, the rest should be easy.&lt;/P&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=qualys QID=48118
[search index=qualys "WebLogic RCE - CVE-2020-14882"
| return 1000 IP]
| stats latest(_time) values(DNS) values(RESULTS) by IP&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Keep in mind that everything returned by the subsearch must be a field in the main search.&amp;nbsp; You'll see why when you look at the &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt; output.&amp;nbsp; That result is ANDed to the main search query, which is why systems with an RCE, but no QID don't show up.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 22:29:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530682#M4266</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-25T22:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530685#M4268</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=qualys QID=48118 OR "WebLogic RCE - CVE-2020-14882"
| stats latest(_time) as _time values(DNS) as DNS values(RESULTS) as RESULTS count(eval(searchmatch("WebLogic RCE - CVE-2020-14882"))) as check_count by IP
| where check_count &amp;gt; 0
| table _time IP DNS RESULTS&lt;/LI-CODE&gt;&lt;P&gt;With Splunk, so let's search and select in bulk.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 21:27:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530685#M4268</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-11-24T21:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530896#M4286</link>
      <description>&lt;P&gt;Thanks for the &lt;FONT face="courier new,courier"&gt;|format&lt;/FONT&gt; insight.&amp;nbsp; That helps.&amp;nbsp; When I use the &lt;FONT face="courier new,courier"&gt;return IP&lt;/FONT&gt; it only returns one IP not the list of IPs.&amp;nbsp; What I would like to see is that there are 15 systems returned from the subsearch and then for each of those systems if they have any QID=48118s then they show up.&amp;nbsp; If none exist then it is blank. i.e. The RESULTS could return a blank if none are found.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 21:00:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530896#M4286</guid>
      <dc:creator>mag314</dc:creator>
      <dc:date>2020-11-25T21:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530898#M4287</link>
      <description>&lt;P&gt;Thanks for your response.&amp;nbsp; Does the searchmatch search across all fields in the record?&amp;nbsp; This returned the 15 systems however all RESULTS from systems with "WebLogic" are returned.&amp;nbsp; How do I only show the RESULTS from QID=48118 and not other QIDs from systems that have "WebLogic".&lt;/P&gt;&lt;P&gt;I want to search all systems with "WebLogic RCE - CVE-2020-14882" and for each of these systems list the QID=48118s if they exist.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 21:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530898#M4287</guid>
      <dc:creator>mag314</dc:creator>
      <dc:date>2020-11-25T21:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530908#M4288</link>
      <description>&lt;P&gt;My mistake.&amp;nbsp; The return command defaults to returning a single entry.&amp;nbsp; I've modified my answer.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 22:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530908#M4288</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-25T22:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530964#M4291</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=qualys QID=48118 AND "WebLogic RCE - CVE-2020-14882"
| stats latest(_time) as _time values(DNS) as DNS values(RESULTS) as RESULTS by IP
| table _time IP DNS RESULTS&lt;/LI-CODE&gt;&lt;P&gt;In those conditions, this would be fine.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 08:18:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/530964#M4291</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-11-26T08:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/531025#M4298</link>
      <description>&lt;P&gt;Interesting When I search&lt;FONT face="courier new,courier"&gt; index=qualys "WebLogic RCE - CVE-2020-14882" | return 1000 IP&lt;/FONT&gt;&amp;nbsp;&amp;nbsp; I get 3 IPs.&amp;nbsp; When I add a dedup IP,&amp;nbsp;&amp;nbsp; i&lt;FONT face="courier new,courier"&gt;ndex=qualys "WebLogic RCE - CVE-2020-14882" | dedup IP | return 1000 IP, &lt;/FONT&gt;&amp;nbsp; I get 15 IPs.&amp;nbsp;&amp;nbsp; I double checked that I am running them over same 30d time span.&amp;nbsp; Any ideas on why that would be the case?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming I use the dedup, this command&amp;nbsp; works well.&amp;nbsp; However since it is using an AND with the subsearch it only shows the 9 of 15 IPs that have the QID.&amp;nbsp; How would I modify it so it would also show the remaining 6 IPs but with blank RESULTS?&amp;nbsp; This is what I was trying to do with my second search in the original post.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;index=qualys QID=48118&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[search index=qualys "WebLogic RCE - CVE-2020-14882"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;|dedup IP | return 1000 IP]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;| stats values(DNS) values(RESULTS) by IP&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your assistance.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 15:51:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/531025#M4298</guid>
      <dc:creator>mag314</dc:creator>
      <dc:date>2020-11-26T15:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/531032#M4299</link>
      <description>&lt;P&gt;This returns 0 results because the QID=48118 AND "WebLogic RCE - CVE-2020-14882" are in separate events.&amp;nbsp;&amp;nbsp; Is there a way to modify your original search to only show QID RESULTS that are 48118?&amp;nbsp; I was trying to do it by filtering out the other QIDs at the beginning but then I lose the "WebLogic" events.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 16:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/531032#M4299</guid>
      <dc:creator>mag314</dc:creator>
      <dc:date>2020-11-26T16:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch - how to search based on results of first search (e.g. foreach)</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/531076#M4305</link>
      <description>&lt;P&gt;| stats ... count(eval(searchmatch("WebLogic RCE - CVE-2020-14882"))) as check_count count(eval(&lt;SPAN&gt;QID=48118)) as check_QID&lt;/SPAN&gt;&amp;nbsp;y IP&lt;/P&gt;&lt;P&gt;| where ... AND&amp;nbsp;check_QID &amp;gt; 0&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 21:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Subsearch-how-to-search-based-on-results-of-first-search-e-g/m-p/531076#M4305</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-11-26T21:25:08Z</dc:date>
    </item>
  </channel>
</rss>

