<?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 Using search result as object of another search in same query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-search-result-as-object-of-another-search-in-same-query/m-p/595612#M207298</link>
    <description>&lt;P&gt;I am learning Splunk (early stages). I have been playing around with this search for the past 2 hours with little success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running this query to get an ip address of the workstation this person is using:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=fortinet* user=XXXX* | top limit=1 sip | table sip&lt;/LI-CODE&gt;
&lt;P&gt;I am trying to tie this search in with another index search (&amp;nbsp;index=wineventlog_pc ) and use that ip address as the source to find the actual name of the workstation being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help or insights would be awesome. Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2022 16:02:39 GMT</pubDate>
    <dc:creator>kryshael</dc:creator>
    <dc:date>2022-04-27T16:02:39Z</dc:date>
    <item>
      <title>Using search result as object of another search in same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-search-result-as-object-of-another-search-in-same-query/m-p/595612#M207298</link>
      <description>&lt;P&gt;I am learning Splunk (early stages). I have been playing around with this search for the past 2 hours with little success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running this query to get an ip address of the workstation this person is using:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=fortinet* user=XXXX* | top limit=1 sip | table sip&lt;/LI-CODE&gt;
&lt;P&gt;I am trying to tie this search in with another index search (&amp;nbsp;index=wineventlog_pc ) and use that ip address as the source to find the actual name of the workstation being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help or insights would be awesome. Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 16:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-search-result-as-object-of-another-search-in-same-query/m-p/595612#M207298</guid>
      <dc:creator>kryshael</dc:creator>
      <dc:date>2022-04-27T16:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using search result as object of another search in same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-search-result-as-object-of-another-search-in-same-query/m-p/595623#M207299</link>
      <description>&lt;P&gt;To use the results of a search in another search, use what Splunk calls a subsearch.&amp;nbsp; Subsearches are enclosed by square brackets and execute first so the one that produces results runs as the subsearch.&amp;nbsp; Those results become part of the main search.&lt;/P&gt;&lt;P&gt;Using the example searches from the OP:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=wineventlog_pc [ 
  | index=fortinet* user=XXXX* | top limit=1 sip | format ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The fortinet index is searched first and the results are converted by the &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt; command into "&lt;FONT face="courier new,courier"&gt;sip=foo&lt;/FONT&gt;". Then the main search becomes &lt;FONT face="courier new,courier"&gt;index=wineventlog_pc sip=foo&lt;/FONT&gt;.&amp;nbsp; Of course, the two indexes must use the same field name ("sip", in this case).&amp;nbsp; If the don't then the subsearch must rename the field to match the name used in the main search.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 17:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-search-result-as-object-of-another-search-in-same-query/m-p/595623#M207299</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-04-27T17:25:51Z</dc:date>
    </item>
  </channel>
</rss>

