<?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 can I pass the results from one search as a field in another search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114486#M30279</link>
    <description>&lt;P&gt;Hello sideview.&lt;/P&gt;

&lt;P&gt;Thank you for the comment.&lt;BR /&gt;
The stats command is just the filter for which record should I remain in use.&lt;/P&gt;

&lt;P&gt;I will look into the format command.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jan 2014 02:02:55 GMT</pubDate>
    <dc:creator>yuwtennis</dc:creator>
    <dc:date>2014-01-20T02:02:55Z</dc:date>
    <item>
      <title>How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114480#M30273</link>
      <description>&lt;P&gt;Hi !&lt;/P&gt;

&lt;P&gt;I would like to have help with search.&lt;/P&gt;

&lt;P&gt;I would like to pass the results from one search&lt;/P&gt;

&lt;P&gt;search xxxxx|xxxxx&lt;BR /&gt;
result:&lt;/P&gt;

&lt;H2&gt;fieldA&lt;/H2&gt;

&lt;P&gt;a&lt;BR /&gt;
b&lt;BR /&gt;
c&lt;BR /&gt;
d&lt;BR /&gt;
e&lt;/P&gt;

&lt;P&gt;to other search as &lt;BR /&gt;
search field=a OR field=b OR field=c OR field=d OR field=e | xxxxx&lt;/P&gt;

&lt;P&gt;Can this be done with append or do you need additional scripting?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Yu&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 07:06:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114480#M30273</guid>
      <dc:creator>yuwtennis</dc:creator>
      <dc:date>2014-01-15T07:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114481#M30274</link>
      <description>&lt;P&gt;Have a look at format. &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Format"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Format&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You can do this by using a subsearch and calling format with custom parameters in order to alter the way the subsearch outputs its results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[search ... | rename fieldA as field | fields field | format "(" "(" "OR" ")" "OR" ")"] | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jan 2014 07:54:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114481#M30274</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2014-01-15T07:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114482#M30275</link>
      <description>&lt;P&gt;Hi ayn.&lt;/P&gt;

&lt;P&gt;I think I found more simpler way.&lt;BR /&gt;
I would rather use join type=inner join&lt;/P&gt;

&lt;P&gt;| join type=inner max=0 fieldA [&lt;BR /&gt;
search index=test1_it OR index=test2_it earliest="11/1/2013:0:0:0" latest="12/1/2013:0:0:0"&lt;BR /&gt;
| sort 0 +fieldA&lt;BR /&gt;
| delta Seq as diffSeq p=1&lt;BR /&gt;
| search diffSeq=*&lt;BR /&gt;
| stats count(eval(diffSeq&amp;gt;0)) as cnt by fieldA&lt;BR /&gt;
| fields fieldA ]&lt;/P&gt;

&lt;P&gt;This is part of actual search.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:39:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114482#M30275</guid>
      <dc:creator>yuwtennis</dc:creator>
      <dc:date>2020-09-28T15:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114483#M30276</link>
      <description>&lt;P&gt;That's simpler? o_O&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 13:12:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114483#M30276</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2014-01-15T13:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114484#M30277</link>
      <description>&lt;P&gt;Well I have to bit amend my words.&lt;/P&gt;

&lt;P&gt;Since the parameters I am passing to the next search will be the results from the stats. Which means I can not use the fixed search commands , like format "(" "(" "OR" ")" "OR" ")"] .&lt;/P&gt;

&lt;P&gt;So I thought I needed to use the join to merge the results.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2014 02:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114484#M30277</guid>
      <dc:creator>yuwtennis</dc:creator>
      <dc:date>2014-01-17T02:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114485#M30278</link>
      <description>&lt;P&gt;definitely don't use join here.  Also if you omit the format command from a subsearch entirely, splunk will sneak one in, and it'll be one with those exact same arguments.   So you can simplify Ayn's answer by removing that format command entirely. &lt;/P&gt;

&lt;P&gt;Also I'm not sure what your intention is with &lt;CODE&gt;stats count(eval(diffSeq&amp;gt;0))&lt;/CODE&gt; but since you're only using the distinct values anyway at the end, it's looks completely equivalent to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* [search index=test1_it OR index=test2_it 
earliest="11/1/2013:0:0:0" latest="12/1/2013:0:0:0"
| dedup fieldA
| fields fieldA ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2014 04:14:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114485#M30278</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2014-01-17T04:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114486#M30279</link>
      <description>&lt;P&gt;Hello sideview.&lt;/P&gt;

&lt;P&gt;Thank you for the comment.&lt;BR /&gt;
The stats command is just the filter for which record should I remain in use.&lt;/P&gt;

&lt;P&gt;I will look into the format command.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 02:02:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114486#M30279</guid>
      <dc:creator>yuwtennis</dc:creator>
      <dc:date>2014-01-20T02:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114487#M30280</link>
      <description>&lt;P&gt;Sideview&lt;/P&gt;

&lt;P&gt;Do you mind if I ask the reason why should I not use the join command?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 02:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114487#M30280</guid>
      <dc:creator>yuwtennis</dc:creator>
      <dc:date>2014-01-20T02:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pass the results from one search as a field in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114488#M30281</link>
      <description>&lt;P&gt;Hello ayn and sideview.&lt;/P&gt;

&lt;P&gt;This solution was what I was looking for!&lt;/P&gt;

&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 02:40:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-pass-the-results-from-one-search-as-a-field-in-another/m-p/114488#M30281</guid>
      <dc:creator>yuwtennis</dc:creator>
      <dc:date>2014-01-20T02:40:57Z</dc:date>
    </item>
  </channel>
</rss>

