<?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: Not another Subsearch Question!  Take values from one search and feed it to another in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326104#M97230</link>
    <description>&lt;P&gt;Hi woodcock.  That is along the lines of what I was thinking however it seems to be pulling events that match PID but not restricting to the hosts that I want (example #5 above).  Let me make sure I am explaining clearly (I suspect I didnt').  &lt;/P&gt;

&lt;P&gt;All events will fall into one of the below :&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;contain:  host, pid&lt;/LI&gt;
&lt;LI&gt;contain:  host, id&lt;/LI&gt;
&lt;LI&gt;contain:  host, pid and id&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I have a call in my network which is identified with an id.  For each host, the 'id' has a direct relationship with a specific 'pid'.  Using the 'id' to search with, I want to be able to pull up the events on those hosts (where the 'id' exists) with the related 'pid'.&lt;/P&gt;

&lt;P&gt;Given:&lt;BR /&gt;
|  host  |  pid     |  id   |&lt;BR /&gt;
|  svr1  |  1000  |  aa  |&lt;BR /&gt;
|  svr2  |  2000  |  aa  |&lt;/P&gt;

&lt;P&gt;I want to return the events where the pid is 1000 on svr1 and 2000 on svr2 &lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2017 20:30:08 GMT</pubDate>
    <dc:creator>lennys26</dc:creator>
    <dc:date>2017-07-21T20:30:08Z</dc:date>
    <item>
      <title>Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326100#M97226</link>
      <description>&lt;P&gt;I am trying to figure out how to find all log events related to a specific linux PID based on a reduced set of hosts (obtained from a search for 'valueB').&lt;/P&gt;

&lt;P&gt;Using the below search, I can get the PIDs and the hosts in which they live. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;myindex&amp;gt; sourcetype=&amp;lt;mysourcetype&amp;gt; valueB | table host, PID, valueB | dedup PID, valueB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will return me a simple list of the PIDs for events related to 'valueB' and the hosts.  I now want to take this list and search for &lt;EM&gt;all&lt;/EM&gt; events for those PIDs in the hosts (where 'valueB' may or may not actually be present within the log line).  &lt;/P&gt;

&lt;P&gt;For example, using the below event lines:&lt;BR /&gt;
1. hostA  PID: 10000  foo&lt;BR /&gt;
2. hostB  PID: 20000  foo&lt;BR /&gt;
3. hostA  PID: 10000&lt;BR /&gt;
4. hostB  PID: 20000&lt;BR /&gt;
5. hostC  PID: 10000&lt;BR /&gt;
6. hostC  PID: 30000 foo&lt;/P&gt;

&lt;P&gt;Knowing 'foo', my end goal is to return the events 1, 2, 3, 4 and NOT 5 or 6.&lt;/P&gt;

&lt;P&gt;This is a subsearch (or a join) but I cant seem to get it to work.&lt;/P&gt;

&lt;P&gt;Any thoughts?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 22:13:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326100#M97226</guid>
      <dc:creator>lennys26</dc:creator>
      <dc:date>2017-07-20T22:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326101#M97227</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=&amp;lt;myindex&amp;gt; sourcetype=&amp;lt;mysourcetype&amp;gt; [search index=&amp;lt;myindex&amp;gt; sourcetype=&amp;lt;mysourcetype&amp;gt; valueB | stats values(PID) AS PID]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jul 2017 22:26:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326101#M97227</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-20T22:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326102#M97228</link>
      <description>&lt;P&gt;why not 6?  It has a foo!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 22:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326102#M97228</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-20T22:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326103#M97229</link>
      <description>&lt;P&gt;Okay, it looks like each host may have multiple PIDS.  For each host, for any PID that has a foo, you want all the records.&lt;/P&gt;

&lt;P&gt;So, this subsearch, with its implicit &lt;CODE&gt;format&lt;/CODE&gt; command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [index=&amp;lt;myindex&amp;gt; sourcetype=&amp;lt;mysourcetype&amp;gt; "foo" | stats by host PID]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...effectively turns into this search term&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ((host=hostA AND PID=10000) OR (host=hostB AND PID=20000) OR (host=hostC AND PID=30000) )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;... therefore this search ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;myindex&amp;gt; sourcetype=&amp;lt;mysourcetype&amp;gt; 
    [index=&amp;lt;myindex&amp;gt; sourcetype=&amp;lt;mysourcetype&amp;gt; "foo" | stats by host PID]
| table host PID WhateverFieldIsFoo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;... should get you records 1-4 and 6 but not 5.  &lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 22:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326103#M97229</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-20T22:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326104#M97230</link>
      <description>&lt;P&gt;Hi woodcock.  That is along the lines of what I was thinking however it seems to be pulling events that match PID but not restricting to the hosts that I want (example #5 above).  Let me make sure I am explaining clearly (I suspect I didnt').  &lt;/P&gt;

&lt;P&gt;All events will fall into one of the below :&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;contain:  host, pid&lt;/LI&gt;
&lt;LI&gt;contain:  host, id&lt;/LI&gt;
&lt;LI&gt;contain:  host, pid and id&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I have a call in my network which is identified with an id.  For each host, the 'id' has a direct relationship with a specific 'pid'.  Using the 'id' to search with, I want to be able to pull up the events on those hosts (where the 'id' exists) with the related 'pid'.&lt;/P&gt;

&lt;P&gt;Given:&lt;BR /&gt;
|  host  |  pid     |  id   |&lt;BR /&gt;
|  svr1  |  1000  |  aa  |&lt;BR /&gt;
|  svr2  |  2000  |  aa  |&lt;/P&gt;

&lt;P&gt;I want to return the events where the pid is 1000 on svr1 and 2000 on svr2 &lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 20:30:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326104#M97230</guid>
      <dc:creator>lennys26</dc:creator>
      <dc:date>2017-07-21T20:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326105#M97231</link>
      <description>&lt;P&gt;My bad; see @DalJeanis&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2017 17:19:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326105#M97231</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-22T17:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326106#M97232</link>
      <description>&lt;P&gt;@lennys26 - still waiting to understand how we are supposed to know not to put out hostc?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2017 21:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326106#M97232</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-23T21:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Not another Subsearch Question!  Take values from one search and feed it to another</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326107#M97233</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=yourIndexHere sourcetype=yourSourcetypeHere [search index=yourIndexHere sourcetype=yourSourcetypeHere id=yourIDhere | dedup host PID | table host PID ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 Jul 2017 21:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-another-Subsearch-Question-Take-values-from-one-search-and/m-p/326107#M97233</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-23T21:36:19Z</dc:date>
    </item>
  </channel>
</rss>

