<?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 How to return value list from subsearch and use it in main search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133696#M36517</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
I'm trying to return a list of values from a subsearch to compare that list to other field values in main search. It should look like this:&lt;/P&gt;

&lt;P&gt;sourcetype=any OR sourcetype=other&lt;BR /&gt;
|eval test =[search sourcetype=any OR sourcetype=other&lt;BR /&gt;
|streamstats count by field1, field2&lt;BR /&gt;
|stats values(field1) AS f1 values(field1) AS f2&lt;BR /&gt;
|mvexpand f1&lt;BR /&gt;
|eval status =if(match(f2,f1),"True","False")&lt;BR /&gt;
|where status ="False"&lt;BR /&gt;
|return f1]&lt;BR /&gt;
|stats values(field3) as f3&lt;BR /&gt;
|where field4 = test&lt;BR /&gt;
|table f3&lt;/P&gt;

&lt;P&gt;Hello,sry that my question above is a bit complicated to understand.What I want to do is this:&lt;BR /&gt;
I'm indexing data from two different sourcetypes that have some similar data in different fields. Now I want to compare the values of two fields (field1 and field2) and check if there are some equal values and get a list of that equal values (lets call it "VALUE_LIST"). Then i want to compare other field values (from field3 and field4) of events that have one of the values from VALUE_LIST in their field1 or field2. At the end i need a table with values from VALUE_LIST, field3 and field4 where field3 and field4 are not eqaul. Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 16:24:11 GMT</pubDate>
    <dc:creator>C_Sparn</dc:creator>
    <dc:date>2020-09-28T16:24:11Z</dc:date>
    <item>
      <title>How to return value list from subsearch and use it in main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133696#M36517</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I'm trying to return a list of values from a subsearch to compare that list to other field values in main search. It should look like this:&lt;/P&gt;

&lt;P&gt;sourcetype=any OR sourcetype=other&lt;BR /&gt;
|eval test =[search sourcetype=any OR sourcetype=other&lt;BR /&gt;
|streamstats count by field1, field2&lt;BR /&gt;
|stats values(field1) AS f1 values(field1) AS f2&lt;BR /&gt;
|mvexpand f1&lt;BR /&gt;
|eval status =if(match(f2,f1),"True","False")&lt;BR /&gt;
|where status ="False"&lt;BR /&gt;
|return f1]&lt;BR /&gt;
|stats values(field3) as f3&lt;BR /&gt;
|where field4 = test&lt;BR /&gt;
|table f3&lt;/P&gt;

&lt;P&gt;Hello,sry that my question above is a bit complicated to understand.What I want to do is this:&lt;BR /&gt;
I'm indexing data from two different sourcetypes that have some similar data in different fields. Now I want to compare the values of two fields (field1 and field2) and check if there are some equal values and get a list of that equal values (lets call it "VALUE_LIST"). Then i want to compare other field values (from field3 and field4) of events that have one of the values from VALUE_LIST in their field1 or field2. At the end i need a table with values from VALUE_LIST, field3 and field4 where field3 and field4 are not eqaul. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133696#M36517</guid>
      <dc:creator>C_Sparn</dc:creator>
      <dc:date>2020-09-28T16:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to return value list from subsearch and use it in main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133697#M36518</link>
      <description>&lt;P&gt;Your &lt;CODE&gt;stats&lt;/CODE&gt;/&lt;CODE&gt;streamstats&lt;/CODE&gt; use is a mess, so it's futile to try to gather your requirements from the search. Do explain your use case in natural language instead.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2014 17:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133697#M36518</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-16T17:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to return value list from subsearch and use it in main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133698#M36519</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
the solution for that problem was using inner join and a where clause for field 3 and 4:&lt;/P&gt;

&lt;P&gt;sourcetype=any | eval Tickets=TicketNumber  |join type=inner Tickets [search sourcetype=other | eval Tickets=TicketNumberOther] |where UserId != UserIdOther |stats  values(UserId) values(UserIdOther) by Tickets&lt;/P&gt;

&lt;P&gt;Greetings&lt;BR /&gt;
C_Sparn&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 07:01:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-value-list-from-subsearch-and-use-it-in-main/m-p/133698#M36519</guid>
      <dc:creator>C_Sparn</dc:creator>
      <dc:date>2014-08-14T07:01:02Z</dc:date>
    </item>
  </channel>
</rss>

