<?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: Recursive sub-search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694452#M236209</link>
    <description>&lt;P&gt;While technically it should be possible to do with &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; 's way of chaining subsearches it's a very bad idea. Subsearches do have their limitation so your result can be completely wrong.&lt;/P&gt;&lt;P&gt;Unfortunately if you really need to do a full text search it's not possible to use the techniques typically used in similar cases since they rely on common fields.&lt;/P&gt;&lt;P&gt;Be aware though that regardless of the subsearch use searching through unparsed data can also be very performance-intensive.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jul 2024 17:53:28 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2024-07-26T17:53:28Z</dc:date>
    <item>
      <title>Recursive sub-search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694332#M236182</link>
      <description>&lt;P&gt;I have 3 separate queries. I need to run them one after the other.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. First query returns a field from each event that matches the search, say eventId&lt;/P&gt;&lt;P&gt;2. I need to make another query to identify events which has this eventId in the event , not a specific field. There will be zero or one row that will be returned in this case. I want to read a field on that event say "traceId".&lt;/P&gt;&lt;P&gt;3. Now i need to make a 3rd query using that returned traceId.&amp;nbsp; There will be only one event. With the result returned, i need to fetch the "fileName" from that matched event.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This fileName is the final result that i need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidelines / example to do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Known issue: On the search 2,&amp;nbsp; eventId from search 1 is not searchable as a field rather should be search on the _raw events as such.&amp;nbsp; I tried sub-search , but always result on OR statement on a field. But i dont have such field on the _raw event for search 2.&lt;/P&gt;&lt;P&gt;Apologies if i sounded this confusing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 19:35:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694332#M236182</guid>
      <dc:creator>rangarbus</dc:creator>
      <dc:date>2024-07-25T19:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive sub-search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694334#M236184</link>
      <description>&lt;P&gt;First, using subsearch should not be your first choice. &amp;nbsp;Second, Splunk is not procedural; forced recursion on command will result in some unmaintainable code.&lt;/P&gt;&lt;P&gt;You need to provide additional information about your data in addition to that your second dataset doesn't have eventId readily extracted. &amp;nbsp;I assume that the first "search" and second have different source types. &amp;nbsp;I also assume that search period is roughly identical in all three. &amp;nbsp;But I don't understand what is the dataset for the third "search". &amp;nbsp;Is it yet another indexed source? &amp;nbsp;Is it some sort of lookup table?&lt;/P&gt;&lt;P&gt;To ask answerable questions in this forum, follow the following golden rules that I call the Four Commandments:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Illustrate data input (in raw text, anonymize as needed), whether they are raw events or output from a search that volunteers here do not have to look at.&lt;/LI&gt;&lt;LI&gt;Illustrate the desired output from illustrated data.&lt;/LI&gt;&lt;LI&gt;Explain the logic between illustrated data and desired output&amp;nbsp;&lt;I&gt;without&lt;/I&gt;&amp;nbsp;SPL.&lt;/LI&gt;&lt;LI&gt;If you also illustrate attempted SPL, illustrate actual output and compare with desired output, explain why they look different&amp;nbsp;&lt;SPAN&gt;to you&lt;/SPAN&gt;&amp;nbsp;if that is not painfully obvious.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 25 Jul 2024 20:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694334#M236184</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-07-25T20:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive sub-search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694372#M236189</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226197"&gt;@rangarbus&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you should try to run these three searches in nested mode starting from the third:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;third_search&amp;gt; 
[ search 
     &amp;lt;second_search&amp;gt;
     [ search
          &amp;lt;first_search&amp;gt;
          | fields eventId
          ]
     | fields traceId
     ]
| table fileName&lt;/LI-CODE&gt;&lt;P&gt;if eventId must be searched as raw text because it isn't in a field called eventId, you could use this one:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;third_search&amp;gt; 
[ search 
     &amp;lt;second_search&amp;gt;
     [ search
          &amp;lt;first_search&amp;gt;
          | rename eventId AS query
          | fields query
          ]
     | fields traceId
     ]
| table fileName&lt;/LI-CODE&gt;&lt;P&gt;I hope that this nested search will run on not so many events because it will not be so performant; if you'll have many events, you shuld accelerate each search in a summary index or in a Data Model.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 06:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694372#M236189</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-07-26T06:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive sub-search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694452#M236209</link>
      <description>&lt;P&gt;While technically it should be possible to do with &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; 's way of chaining subsearches it's a very bad idea. Subsearches do have their limitation so your result can be completely wrong.&lt;/P&gt;&lt;P&gt;Unfortunately if you really need to do a full text search it's not possible to use the techniques typically used in similar cases since they rely on common fields.&lt;/P&gt;&lt;P&gt;Be aware though that regardless of the subsearch use searching through unparsed data can also be very performance-intensive.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 17:53:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Recursive-sub-search/m-p/694452#M236209</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-07-26T17:53:28Z</dc:date>
    </item>
  </channel>
</rss>

