<?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: Subsearch not returning any results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574273#M200128</link>
    <description>&lt;P&gt;Thank you, JC.&amp;nbsp; I very much appreciate the assist, unfortunately that didn't help.&amp;nbsp; Returns no results again.&lt;/P&gt;&lt;P&gt;The regex actually provides me with the GUID.&amp;nbsp; It's a much longer string in the logs.&amp;nbsp; And the first query with the GUID hardcoded gives me the final results I'm looking for.&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp; Cheers,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 18:45:24 GMT</pubDate>
    <dc:creator>gillockb</dc:creator>
    <dc:date>2021-11-09T18:45:24Z</dc:date>
    <item>
      <title>Subsearch not returning any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574213#M200112</link>
      <description>&lt;P&gt;Hello Splunksters,&lt;/P&gt;&lt;P&gt;I'm new to Splunk and am constructing my first subsearch.&amp;nbsp; I've read the &lt;A title="Use a subsearch" href="https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchTutorial/Useasubsearch" target="_blank" rel="noopener"&gt;documentation on subsearches&lt;/A&gt;, but am apparently missing something fundamental.&amp;nbsp; I have a log file that captures and records events based on a GUID.&amp;nbsp; Obviously GUIDs aren't something one goes searching for directly.&amp;nbsp; The primary search is by phone number.&amp;nbsp; So, I need to accept a phone number, retrieve the associated GUID and then return all the results tied to that GUID.&amp;nbsp; I have the search retrieving the GUID working, and want to use that as the subsearch.&lt;/P&gt;&lt;P&gt;Ultimate search I wish to run:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="myIndex" sourcetype="mySourceType" 7c10cfbc-6892-4590-a05c-c12acf16932b&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search retrieving GUID (this works):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="myIndex" host="myHost" sourcetype="mySourceType" &amp;lt;phoneNumber&amp;gt;
| rex field=_raw "(?&amp;lt;GUID&amp;gt;\].*$$)"
| rex field=GUID "(?&amp;lt;GUID&amp;gt;[^NAME]+)"
| eval GUID=replace(GUID, "]", "")
| rex field=GUID mode=sed "s/(^\s+)|(\s+$)//g"
| dedup GUID
| table GUID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I thought the subsearch should look like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="myIndex" sourcetype="mySourceType"  [search index="myIndex" host="myHost" sourcetype="mySourceType" &amp;lt;phoneNumber&amp;gt;
| rex field=_raw "(?&amp;lt;GUID&amp;gt;\].*$$)"
| rex field=GUID "(?&amp;lt;GUID&amp;gt;[^NAME]+)"
| eval GUID=replace(GUID, "]", "")
| rex field=GUID mode=sed "s/(^\s+)|(\s+$)//g"
| dedup GUID
| table GUID]&lt;/LI-CODE&gt;&lt;P&gt;Everything in the [] returns the GUID, as I understand the doc, that should be what is searched for in the main search.&amp;nbsp; What am I missing?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 15:11:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574213#M200112</guid>
      <dc:creator>gillockb</dc:creator>
      <dc:date>2021-11-09T15:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch not returning any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574217#M200115</link>
      <description>&lt;P&gt;Try adding a join:&lt;/P&gt;&lt;P&gt;The sub search should produce the GUID based on your logic, however the format of the GUID in the outer search would need to match.&amp;nbsp; If the inner search shows the GUID as&lt;/P&gt;&lt;PRE&gt;7c10cfbc-6892-4590-a05c-c12acf16932b&lt;/PRE&gt;&lt;P&gt;after you replace and rex then the outer search would also need to have a match GUID field of&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;7c10cfbc-6892-4590-a05c-c12acf16932b&lt;/PRE&gt;&lt;P&gt;index="myIndex" sourcetype="mySourceType"&lt;BR /&gt;| join GUID [search index="myIndex" host="myHost" sourcetype="mySourceType" &amp;lt;phoneNumber&amp;gt;&lt;BR /&gt;| rex field=_raw "(?&amp;lt;GUID&amp;gt;\].*$$)"&lt;BR /&gt;| rex field=GUID "(?&amp;lt;GUID&amp;gt;[^NAME]+)"&lt;BR /&gt;| eval GUID=replace(GUID, "]", "")&lt;BR /&gt;| rex field=GUID mode=sed "s/(^\s+)|(\s+$)//g"&lt;BR /&gt;| dedup GUID&lt;BR /&gt;| fields GUID ]&lt;BR /&gt;| table GUID, &amp;lt;other fields from the outer search you want to display&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 15:21:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574217#M200115</guid>
      <dc:creator>jcraumer</dc:creator>
      <dc:date>2021-11-09T15:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch not returning any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574273#M200128</link>
      <description>&lt;P&gt;Thank you, JC.&amp;nbsp; I very much appreciate the assist, unfortunately that didn't help.&amp;nbsp; Returns no results again.&lt;/P&gt;&lt;P&gt;The regex actually provides me with the GUID.&amp;nbsp; It's a much longer string in the logs.&amp;nbsp; And the first query with the GUID hardcoded gives me the final results I'm looking for.&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp; Cheers,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 18:45:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574273#M200128</guid>
      <dc:creator>gillockb</dc:creator>
      <dc:date>2021-11-09T18:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch not returning any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574469#M200196</link>
      <description>&lt;P&gt;Bah!&amp;nbsp; I figured it out.&amp;nbsp; I did not realize the format command was being applied to the subsearch resulting in&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;( ( GUID="7c10cfbc-6892-4590-a05c-c12acf16932b" ) ) &lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;instead of just the GUID value.&amp;nbsp; And as the raw data does not contain a GUID field, there was nothing to match it to.&amp;nbsp; Since I constructed the subsearch in the Search app it was giving me just the value I was looking for.&amp;nbsp; Hard lesson learned...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I ran an Extract&amp;nbsp; New Fields to create the GUID field from the raw data and now am receiving the results I desire.&amp;nbsp; Thanks all for taking a look and thanks again, JC for trying to help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 18:28:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574469#M200196</guid>
      <dc:creator>gillockb</dc:creator>
      <dc:date>2021-11-10T18:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch not returning any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574472#M200197</link>
      <description>&lt;P&gt;Glad you were able to figure it out.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 18:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-not-returning-any-results/m-p/574472#M200197</guid>
      <dc:creator>jcraumer</dc:creator>
      <dc:date>2021-11-10T18:41:11Z</dc:date>
    </item>
  </channel>
</rss>

