<?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 produced 144180 results, truncating to maxout 10000. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433663#M123793</link>
    <description>&lt;P&gt;@sumitkathpal, if your use-case is to show tstats count only for sources/domains present in the lookup, instead of using &lt;CODE&gt;| inputlookup&lt;/CODE&gt; which will run as a subsearch, you can run &lt;CODE&gt;lookup&lt;/CODE&gt; command to identify the domains that are present in the lookup and those which are not can be filtered out. Please try the following query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `summariesonly` count from datamodel=Email by All_Email.src_user All_Email.subject 
| `drop_dm_object_name("All_Email")` 
| lookup local_domain_intel.csv domain as src_user outputnew domain as domainFromLookup
| search domainFromLookup!=""
| fields - domainFromLookup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is the run anywhere sample approach that I used to test:&lt;/P&gt;

&lt;P&gt;1) &lt;STRONG&gt;Created .15M events for lookup&lt;/STRONG&gt;. Used streamstats to create unique source names as &lt;CODE&gt;domain&lt;/CODE&gt;. PS: datasource="lookup" is created as identifier just for demo purpose.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=150000 
| fields - _time
| streamstats count as domain 
| eval domain="src".printf("%06d",domain), datasource="lookup"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) &lt;STRONG&gt;Piped outputlookup&lt;/STRONG&gt; to above result to save as &lt;CODE&gt;localtestdata.csv&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| outputlookup localtestdata.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) Used new query to generate stats count by various sources. PS: count below can be changed to any number you want to test. I tested with &lt;CODE&gt;1.5M&lt;/CODE&gt; as well. Following is 15K for demo example. Eval function &lt;CODE&gt;random()&lt;/CODE&gt; along with &lt;CODE&gt;substr()&lt;/CODE&gt; is used to generate some &lt;CODE&gt;random count&lt;/CODE&gt;. PS: datasource="tstats" is just for demo purpose.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=15000 
| fields - _time 
| streamstats count as src_user
| eval src_user=if(src_user&amp;lt;=100,"0",src_user )
| eval src_user="src".printf("%06d",src_user), count=substr("".random(),4), datasource="tstats"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: &lt;CODE&gt;| eval src_user=if(src_user&amp;lt;=100,"0",src_user )&lt;/CODE&gt; eval has been added in raw event to &lt;CODE&gt;rename first 100 events as src000000&lt;/CODE&gt; so that not all events from search matches data in lookup.&lt;/P&gt;

&lt;P&gt;4) Once Lookup file using Step 1 and Step 2 is created and you have run a new search with Query 3 to generate your sample events you can &lt;STRONG&gt;match the &lt;CODE&gt;srcuser&lt;/CODE&gt; field in raw event with &lt;CODE&gt;domain&lt;/CODE&gt; field in lookup and filter only matched domains&lt;/STRONG&gt; using the following command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup localtestdata.csv domain as src_user outputnew domain as domainFromLookup
| search domainFromLookup!=""
| fields - domainFromLookup
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Apr 2019 16:18:32 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2019-04-29T16:18:32Z</dc:date>
    <item>
      <title>Subsearch produced 144180 results, truncating to maxout 10000.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433660#M123790</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am running tstats command and matching with large lookup file but i am getting the "[subsearch]: Subsearch produced 144180 results, truncating to maxout 10000."&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `summariesonly` count from datamodel=Email by All_Email.src_user All_Email.subject | `drop_dm_object_name("All_Email")` | search [| inputlookup  local_domain_intel.csv| rename domain as src_user |fields src_user ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My question is : Does my search match it with lookup file and then it truncate to 10000 results ? &lt;BR /&gt;
Or First it truncate the lookup file with 10000 than compare with my search ? I checked in my lookup last row i updated with known domain and saved , search didn't produce any result . If i move this known domain in first row than search matches and produces result.&lt;/P&gt;

&lt;P&gt;Also how to remove this error ?&lt;/P&gt;

&lt;P&gt;lookup file row : 144180&lt;/P&gt;

&lt;P&gt;Reason &lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 06:11:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433660#M123790</guid>
      <dc:creator>sumitkathpal</dc:creator>
      <dc:date>2019-04-29T06:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch produced 144180 results, truncating to maxout 10000.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433661#M123791</link>
      <description>&lt;P&gt;The subsearch executes first and is limited to returning 10,000 results.  It is governed by the &lt;CODE&gt;maxout&lt;/CODE&gt; setting in limits.conf, but must always be less than 10500 so changing this value will not help you.  You will have to redesign your query.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 12:52:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433661#M123791</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-04-29T12:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch produced 144180 results, truncating to maxout 10000.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433662#M123792</link>
      <description>&lt;P&gt;You can change the search to use the lookup, something like ( change fields as needed)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `summariesonly` count from datamodel=Email by All_Email.src_user All_Email.subject | `drop_dm_object_name("All_Email")` | inputlookup  local_domain_intel.csv domain AS src_user  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will match the src_user in the tstats results to lookup contents and return matched results.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 14:42:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433662#M123792</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-04-29T14:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch produced 144180 results, truncating to maxout 10000.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433663#M123793</link>
      <description>&lt;P&gt;@sumitkathpal, if your use-case is to show tstats count only for sources/domains present in the lookup, instead of using &lt;CODE&gt;| inputlookup&lt;/CODE&gt; which will run as a subsearch, you can run &lt;CODE&gt;lookup&lt;/CODE&gt; command to identify the domains that are present in the lookup and those which are not can be filtered out. Please try the following query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `summariesonly` count from datamodel=Email by All_Email.src_user All_Email.subject 
| `drop_dm_object_name("All_Email")` 
| lookup local_domain_intel.csv domain as src_user outputnew domain as domainFromLookup
| search domainFromLookup!=""
| fields - domainFromLookup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is the run anywhere sample approach that I used to test:&lt;/P&gt;

&lt;P&gt;1) &lt;STRONG&gt;Created .15M events for lookup&lt;/STRONG&gt;. Used streamstats to create unique source names as &lt;CODE&gt;domain&lt;/CODE&gt;. PS: datasource="lookup" is created as identifier just for demo purpose.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=150000 
| fields - _time
| streamstats count as domain 
| eval domain="src".printf("%06d",domain), datasource="lookup"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) &lt;STRONG&gt;Piped outputlookup&lt;/STRONG&gt; to above result to save as &lt;CODE&gt;localtestdata.csv&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| outputlookup localtestdata.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) Used new query to generate stats count by various sources. PS: count below can be changed to any number you want to test. I tested with &lt;CODE&gt;1.5M&lt;/CODE&gt; as well. Following is 15K for demo example. Eval function &lt;CODE&gt;random()&lt;/CODE&gt; along with &lt;CODE&gt;substr()&lt;/CODE&gt; is used to generate some &lt;CODE&gt;random count&lt;/CODE&gt;. PS: datasource="tstats" is just for demo purpose.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=15000 
| fields - _time 
| streamstats count as src_user
| eval src_user=if(src_user&amp;lt;=100,"0",src_user )
| eval src_user="src".printf("%06d",src_user), count=substr("".random(),4), datasource="tstats"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: &lt;CODE&gt;| eval src_user=if(src_user&amp;lt;=100,"0",src_user )&lt;/CODE&gt; eval has been added in raw event to &lt;CODE&gt;rename first 100 events as src000000&lt;/CODE&gt; so that not all events from search matches data in lookup.&lt;/P&gt;

&lt;P&gt;4) Once Lookup file using Step 1 and Step 2 is created and you have run a new search with Query 3 to generate your sample events you can &lt;STRONG&gt;match the &lt;CODE&gt;srcuser&lt;/CODE&gt; field in raw event with &lt;CODE&gt;domain&lt;/CODE&gt; field in lookup and filter only matched domains&lt;/STRONG&gt; using the following command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup localtestdata.csv domain as src_user outputnew domain as domainFromLookup
| search domainFromLookup!=""
| fields - domainFromLookup
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Apr 2019 16:18:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-produced-144180-results-truncating-to-maxout-10000/m-p/433663#M123793</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-04-29T16:18:32Z</dc:date>
    </item>
  </channel>
</rss>

