<?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 search results from one sourcetype search to be included in a second search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345079#M102229</link>
    <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="CVE" host="VulScanner" (Risk=High OR Risk=Critical) [search  sourcetype=DB ADM | dedup host_name | rex  field=host_name "(?(\w+\-\w+))" | stats count by owner Host| where Host != " " | table owner Host | rename Host as extracted_Host owner as Name ]
 | eval Time=_time 
 | dedup Solution
 | convert timeformat="%Y-%m-%d %H:%M:%S" ctime(Time) 
 | table Time, extracted_Host, Risk, Name, CVE, Solution, "See Also" ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 Jun 2017 19:04:18 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-06-13T19:04:18Z</dc:date>
    <item>
      <title>How to use search results from one sourcetype search to be included in a second search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345078#M102228</link>
      <description>&lt;P&gt;Good day,&lt;BR /&gt;
My first search pulls servername and owner from a sourcetype (database).  I then need to take the servername, owner, and match that info with the results from a CVE vulnerability search, having the servername as the constant in both searches.  I have attempted append, join, and subsearch.  I can get results but the owner will not match up with the Host and extracted_Host in a one to one relationship .&lt;/P&gt;

&lt;P&gt;Search #1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DB ADM
| dedup host_name
| rex  field=host_name "(?(\w+\-\w+))" 
| stats values(Host) as Host by owner
| where Host != " " 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search #2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="CVE" host="VulScanner" (Risk=High OR Risk=Critical)
| eval Time=_time 
| dedup Solution
| convert timeformat="%Y-%m-%d %H:%M:%S" ctime(Time) 
| table Time, extracted_Host, Risk, Name, CVE, Solution, "See Also" ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I do a join this gives me the owner column, but the two Host and extracted_Host columns do not tie together.&lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 18:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345078#M102228</guid>
      <dc:creator>bewald_cfi</dc:creator>
      <dc:date>2017-06-13T18:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use search results from one sourcetype search to be included in a second search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345079#M102229</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="CVE" host="VulScanner" (Risk=High OR Risk=Critical) [search  sourcetype=DB ADM | dedup host_name | rex  field=host_name "(?(\w+\-\w+))" | stats count by owner Host| where Host != " " | table owner Host | rename Host as extracted_Host owner as Name ]
 | eval Time=_time 
 | dedup Solution
 | convert timeformat="%Y-%m-%d %H:%M:%S" ctime(Time) 
 | table Time, extracted_Host, Risk, Name, CVE, Solution, "See Also" ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 19:04:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345079#M102229</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-13T19:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use search results from one sourcetype search to be included in a second search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345080#M102230</link>
      <description>&lt;P&gt;Unfortunately, the search returns with "No results found".&lt;BR /&gt;&lt;BR /&gt;
For &lt;BR /&gt;
|rex field=host_name "(?(\w+-\w+)) &lt;BR /&gt;
I had to add &lt;BR /&gt;
"(?(\w+-\w+))" &lt;BR /&gt;
because it initially gave error = Regex: unmatched parentheses &lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 20:00:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345080#M102230</guid>
      <dc:creator>bewald_cfi</dc:creator>
      <dc:date>2017-06-13T20:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use search results from one sourcetype search to be included in a second search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345081#M102231</link>
      <description>&lt;P&gt;When you post code/query, select whole query and click on "101010" button or Ctrl+K to format. You can see that rex was truncated in the question.&lt;/P&gt;

&lt;P&gt;The query assumes that field &lt;CODE&gt;Host&lt;/CODE&gt; and &lt;CODE&gt;owner&lt;/CODE&gt; from &lt;CODE&gt;sourcetype=DB ADM&lt;/CODE&gt; are mapped (exact value match) to the field &lt;CODE&gt;extracted_Host&lt;/CODE&gt; and &lt;CODE&gt;Name&lt;/CODE&gt; from &lt;CODE&gt;sourcetype="CVE" host="VulScanner"&lt;/CODE&gt;. Is that correct assumption?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 20:14:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345081#M102231</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-13T20:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use search results from one sourcetype search to be included in a second search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345082#M102232</link>
      <description>&lt;P&gt;Somesoni2 - thank you for your help and time.  The two sourcetypes do not have an exact value match for everything considered a host, but some are.  One sourcetype uses a database, compiled by data sent from a local agent that lives on each server, the other sourcetype uses data received from a Nessus scan.  I hope this answers your question.  Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 12:22:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-search-results-from-one-sourcetype-search-to-be/m-p/345082#M102232</guid>
      <dc:creator>bewald_cfi</dc:creator>
      <dc:date>2017-06-14T12:22:39Z</dc:date>
    </item>
  </channel>
</rss>

