<?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: Nested Search Query in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326699#M4655</link>
    <description>&lt;P&gt;Ahhh... that please ignore. It was a dummy query and I just used one of the keyword from our logs &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2017 13:43:25 GMT</pubDate>
    <dc:creator>kartiksha</dc:creator>
    <dc:date>2017-06-05T13:43:25Z</dc:date>
    <item>
      <title>Nested Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326695#M4651</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need a way to merge these two queries to get a proper report with having to run them separately.&lt;/P&gt;

&lt;P&gt;First Query to generate a list of IDs:&lt;BR /&gt;
source="Source1" receiverAddress=&lt;A href="mailto:test@test.com"&gt;test@test.com&lt;/A&gt;| dedup "attachments{}.UniqueID"|table "attachments{}.UniqueID"&lt;/P&gt;

&lt;P&gt;Results (EX):&lt;BR /&gt;
1e32fdc2-5519-4e3a-2233-88e49a21e663&lt;/P&gt;

&lt;P&gt;Second Query to generate actual results:&lt;BR /&gt;
source="Source2" UniqueID=1e32fdc2-5519-4e3a-2233-88e49a21e663 CreateEvent|dedup UniqueID| timechart span=1d count(UniqueID) as "Test"&lt;/P&gt;

&lt;P&gt;Results (EX):&lt;BR /&gt;
_time           Test&lt;BR /&gt;
2017-05-29      1&lt;/P&gt;

&lt;P&gt;I tried to use Nested Query like:&lt;BR /&gt;
source="Source2" [search source="Source1" receiverAddress=&lt;A href="mailto:test@test.com"&gt;test@test.com&lt;/A&gt;| dedup "attachments{}.UniqueID"|table "attachments{}.UniqueID"] CreateEvent|dedup UniqueID| timechart span=1d count(UniqueID) as "Test"&lt;/P&gt;

&lt;P&gt;But unfortunately it returns nothing. Is there something I'm doing incorrectly?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Kartik Sharma&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 19:38:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326695#M4651</guid>
      <dc:creator>kartiksha</dc:creator>
      <dc:date>2017-06-04T19:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326696#M4652</link>
      <description>&lt;P&gt;You basically had it, except for one thing.  compare these two points...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ...| table "attachments{}.UniqueID"  ]...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... UniqueID=1e32fdc2-5519-4e3a-2233-88e49a21e663 ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you rename the first fieldname to be the same as the second, then it should work.  Test it first with &lt;CODE&gt;head 1&lt;/CODE&gt; to save on run time, as below...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo source="Source2" 
    [ search index=bar source="Source1" receiverAddress=test@test.com 
    | dedup "attachments{}.UniqueID" 
    | rename "attachments{}.UniqueID" as UniqueID 
    | head 1 
    | table UniqueID]  
   CreateEvent
| dedup UniqueID
| timechart span=1d count(UniqueID) as "Test"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not familiar with "CreateEvent" - if that is a macro, there should be a tickmark in front of it, and we would have to investigate the code to make sure it would work in that spot with with multiple records.  If it is a fieldname, then CreateEvent=* would be more descriptive.  If it is a literal, then quotes around it would be better practice.   &lt;/P&gt;

&lt;P&gt;if it is a macro, then get a second unique id and try this first - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Source2" (UniqueID=1e32fdc2-5519-4e3a-2233-88e49a21e663 OR UniqueID=SomeOtherIdThatIsThere) CreateEvent|dedup UniqueID| timechart span=1d count(UniqueID) as "Test"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Jun 2017 22:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326696#M4652</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-04T22:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326697#M4653</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;It worked. Thanks for your support DalJeanis. I now need to work on more advanced dashboard so would come back if further queries.&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Kartik Sharma&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 09:29:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326697#M4653</guid>
      <dc:creator>kartiksha</dc:creator>
      <dc:date>2017-06-05T09:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326698#M4654</link>
      <description>&lt;P&gt;Great!  &lt;/P&gt;

&lt;P&gt;So, for my curiosity and everybody's edification, what was CreateEvent?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 12:59:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326698#M4654</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-05T12:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326699#M4655</link>
      <description>&lt;P&gt;Ahhh... that please ignore. It was a dummy query and I just used one of the keyword from our logs &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:43:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Nested-Search-Query/m-p/326699#M4655</guid>
      <dc:creator>kartiksha</dc:creator>
      <dc:date>2017-06-05T13:43:25Z</dc:date>
    </item>
  </channel>
</rss>

