<?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: The Results from a Subsearch Need to be Used as an OR in the Main Search in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459590#M30151</link>
    <description>&lt;P&gt;What's your full search?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2019 20:27:49 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-08-22T20:27:49Z</dc:date>
    <item>
      <title>The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459586#M30147</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I have a main search, with an append command. &lt;BR /&gt;
Some events contain just the &lt;STRONG&gt;user&lt;/STRONG&gt;; others just the &lt;STRONG&gt;addr&lt;/STRONG&gt;; and still others both the &lt;STRONG&gt;user&lt;/STRONG&gt; and the &lt;STRONG&gt;addr&lt;/STRONG&gt;. The issue is I only know &lt;STRONG&gt;user&lt;/STRONG&gt;. However, to find events which contain just the &lt;STRONG&gt;addr&lt;/STRONG&gt; I need to search the log for events where the &lt;STRONG&gt;user!=""&lt;/STRONG&gt; and where &lt;STRONG&gt;addr!=""&lt;/STRONG&gt;. Then I can run a new search on log with &lt;STRONG&gt;$addr=addr&lt;/STRONG&gt;. I will use dedup at the end.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|append
              [  search index ="events"
                AND source="log" 
                AND (user="$userId_tok$"
                  OR [ search index ="events"
                     AND source="/log"  
                     AND user="$userId_tok$"
                    | head limit=1
                    | eval addr="\"".addr."\""
                    | return $addr ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can OR work with subsearches?&lt;/P&gt;

&lt;P&gt;I hope that makes sense.&lt;/P&gt;

&lt;P&gt;Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 18:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459586#M30147</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2019-08-22T18:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459587#M30148</link>
      <description>&lt;P&gt;It should work with OR (your just need to ensure that proper brackets are placed so that your logic is correct. Your second subsearch is just returning the value (because of dollar sign), so your search becomes this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search index ="events"
                 AND source="log" 
                 AND (user="$userId_tok$"
                   OR ("address_value_returned_from_subsearch")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That is intentional right?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 19:03:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459587#M30148</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-08-22T19:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459588#M30149</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt; &lt;BR /&gt;
Yes. Don't forget the trailing ).&lt;/P&gt;

&lt;P&gt;AND &lt;STRONG&gt;(&lt;/STRONG&gt;user="$userId_tok$"&lt;BR /&gt;
                    OR ("address_value_returned_from_subsearch")&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:52:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459588#M30149</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2020-09-30T01:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459589#M30150</link>
      <description>&lt;P&gt;@somesoni2 &lt;BR /&gt;
Also, here is the error message.&lt;/P&gt;

&lt;P&gt;Error in 'SearchParser': Subsearches are only valid as arguments to commands. &lt;/P&gt;

&lt;P&gt;Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 19:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459589#M30150</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2019-08-22T19:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459590#M30151</link>
      <description>&lt;P&gt;What's your full search?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 20:27:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459590#M30151</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-08-22T20:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459591#M30152</link>
      <description>&lt;P&gt;The way that subsearches work by default is that the fields within a row are combined with &lt;CODE&gt;AND&lt;/CODE&gt; and then rows are combined with &lt;CODE&gt;OR&lt;/CODE&gt;.  You can see what is done by running your subsearch and then adding &lt;CODE&gt;| format&lt;/CODE&gt; to the end and it will show you the SPL that it will generate.  Additionally, the &lt;CODE&gt;format&lt;/CODE&gt; command allows you to change the &lt;CODE&gt;AND&lt;/CODE&gt; to &lt;CODE&gt;OR&lt;/CODE&gt; or the &lt;CODE&gt;OR&lt;/CODE&gt; to &lt;CODE&gt;AND&lt;/CODE&gt; if you like, by passing the appropriate arguments.  Check it out:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/Changetheformatofsubsearchresults"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Search/Changetheformatofsubsearchresults&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 21:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459591#M30152</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-09-17T21:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459592#M30153</link>
      <description>&lt;P&gt;@woodcock ,&lt;BR /&gt;
I want to thank you for your reply. I will check into later this afternoon. I'm prepping for a meeting.&lt;BR /&gt;
Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 13:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459592#M30153</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2019-09-18T13:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459593#M30154</link>
      <description>&lt;P&gt;@somesoni2 &lt;BR /&gt;
As this is a new Splunk implementation, before I get a chance to complete one thing, another is tossed our way.&lt;BR /&gt;
I am getting back to old forum posts to thanks people and close.&lt;BR /&gt;
Apologies for the delay.&lt;BR /&gt;
Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 13:49:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459593#M30154</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2019-09-26T13:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459594#M30155</link>
      <description>&lt;P&gt;@woodcock &lt;BR /&gt;
As this is a new Splunk implementation, before I get a chance to complete one thing, another is tossed our way.&lt;BR /&gt;
I am getting back to old forum posts to thanks people and close.&lt;BR /&gt;
Using | format and the supplied link have been a great education.&lt;/P&gt;

&lt;P&gt;Apologies for the delay.&lt;BR /&gt;
Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 13:50:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459594#M30155</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2019-09-26T13:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459595#M30156</link>
      <description>&lt;P&gt;Be sure to come back and click &lt;CODE&gt;Accept&lt;/CODE&gt; to close the question and &lt;CODE&gt;UpVote&lt;/CODE&gt; and useful answers or comments.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 14:48:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459595#M30156</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-09-26T14:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: The Results from a Subsearch Need to be Used as an OR in the Main Search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459596#M30157</link>
      <description>&lt;P&gt;@woodcock &lt;BR /&gt;
Got it. Done.&lt;BR /&gt;
I saw the Accept button over my response and thought I would be accepting mine and not yours. Thanks and God bless,&lt;BR /&gt;
Genesius&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 15:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/The-Results-from-a-Subsearch-Need-to-be-Used-as-an-OR-in-the/m-p/459596#M30157</guid>
      <dc:creator>genesiusj</dc:creator>
      <dc:date>2019-09-26T15:33:03Z</dc:date>
    </item>
  </channel>
</rss>

