<?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 to finetune subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755883#M243020</link>
    <description>&lt;P&gt;This is a little tricky to follow exactly what you are trying to do. Please provide some obfuscated / desensitised sample events from both sources in raw and unformatted mode, preferably in a code block &amp;lt;/&amp;gt; so they can be copied and pasted into a makeresults command to enable us to try out some potential solutions for you. It is nearly always the most expedient way to approach requesting help with searches.&lt;/P&gt;&lt;P&gt;Having said that, you could try including both sources on the initial search line which would avoid the subsearch limitations, you just then need to be able to filter and combine the events (hence the need to see what you are dealing with!).&lt;/P&gt;</description>
    <pubDate>Wed, 26 Nov 2025 06:07:41 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2025-11-26T06:07:41Z</dc:date>
    <item>
      <title>How to finetune subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755881#M243018</link>
      <description>&lt;P&gt;I have below requirement. I am working on two types of events.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source 1 - From here I wanted to take employee email and url. Then using lookup I am taking emp id for respective email.&amp;nbsp; And from url am fetching domain. These are the two key fields (empid and domain) i need to compare with Source 2. Along with this I need to take other set of fields too like sender, clickip and some others&lt;/P&gt;&lt;P&gt;Source 2 - From here i just need to take status of particular event - Status can be allow or block&lt;/P&gt;&lt;P&gt;index=source2 userid=$empid$ domain=$domain$ | stats values(status)&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried below&lt;BR /&gt;1. I used map and taking results from source 1 and passing it via map command to source. then did stats. It works fine. But problem is am unable to enable the durablitity for this saved search. is there any way to do this?&lt;/P&gt;&lt;P&gt;2. So I used append. I used both searches with append and taking the stats. Here i evaluated a new field called type in both sources and kept type=source1 and type=source2 in both queries and then took status values(type) and mvcount(type) = 2 then am taking results. Thsi is too working fine but hit the subsearch count 50k in the limit. I am unable to increase this limit as of now due to restricitions . Is there any other workaround&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 04:54:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755881#M243018</guid>
      <dc:creator>NAGA4</dc:creator>
      <dc:date>2025-11-26T04:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to finetune subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755883#M243020</link>
      <description>&lt;P&gt;This is a little tricky to follow exactly what you are trying to do. Please provide some obfuscated / desensitised sample events from both sources in raw and unformatted mode, preferably in a code block &amp;lt;/&amp;gt; so they can be copied and pasted into a makeresults command to enable us to try out some potential solutions for you. It is nearly always the most expedient way to approach requesting help with searches.&lt;/P&gt;&lt;P&gt;Having said that, you could try including both sources on the initial search line which would avoid the subsearch limitations, you just then need to be able to filter and combine the events (hence the need to see what you are dealing with!).&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 06:07:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755883#M243020</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-11-26T06:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to finetune subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755886#M243023</link>
      <description>&lt;P&gt;As you will find everywhere in this forum, map is usually not the solution; subsearch also should not be the default go to. &amp;nbsp;What you ought to ask yourself are:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;What is my input?&lt;/LI&gt;&lt;LI&gt;What is my desired output?&lt;/LI&gt;&lt;LI&gt;What is the logical relationship between input and desired output?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Once you can verbalize these, you will find that stats is often all you need. &amp;nbsp;But in your case, you are not interested in source1 at all. &amp;nbsp;So, subsearch could be of good use - but not with map or append.&lt;/P&gt;&lt;P&gt;Let me see if I get your question correct. &amp;nbsp;You have two sources, source1 has two fields of interest, &lt;FONT face="courier new,courier"&gt;empid&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;domain&lt;/FONT&gt;; source2 has three, &lt;FONT face="courier new,courier"&gt;userid&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;domain&lt;/FONT&gt;, and &lt;FONT face="courier new,courier"&gt;status&lt;/FONT&gt;. &amp;nbsp;All you want is a list of unique values of &lt;FONT face="courier new,courier"&gt;status&lt;/FONT&gt; - like 200, 203, 400, 404, 500, 501, as long as they are from index=source2 that matches any and all allowable combinations of &lt;FONT face="courier new,courier"&gt;empid&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;domain&lt;/FONT&gt; from index=source1 provided that &lt;FONT face="courier new,courier"&gt;userid&lt;/FONT&gt; in source2 equaling an allowable &lt;FONT face="courier new,courier"&gt;empid&lt;/FONT&gt; in source1.&lt;/P&gt;&lt;P&gt;If the above is correct, the simplest approach would be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = source2
| tojson output_field=user_domain userid domain
| search
  [search index = source1
    | fields empid domain
    | rename empid as userid
    | stats count by userid domain ``` can be simplified to dedup but performance may suffer ```
    | fields - count
    | tojson output_field=user_domain userid domain]
| stats values(status)&lt;/LI-CODE&gt;&lt;P&gt;Here, subsearch is used as a filter, not going through append. &amp;nbsp;So, the 50K limit doesn't apply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;A more traditional approach with no subsearch could be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index IN (source1, source2)
| eval userid = coalesce(userid, empid)
| stats values(status) as status values(index) as sources by userid domain
| where sources = "source1" ``` make sure to only count empid-domain combo that do appear in source1 ```
| stats values(status)&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 07:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-finetune-subsearch/m-p/755886#M243023</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-11-26T07:03:58Z</dc:date>
    </item>
  </channel>
</rss>

