Reporting

Detecting when subsearch limits are exceeded by scheduled searches

jonaclough
Path Finder

Is there a way to detect subsearch limits being exceeded in scheduled searches

I notice that you can get this info from REST:

| rest splunk_server=local /servicesNS/$user$/$app$/search/jobs/$search_id$ 
| where isnotnull('messages.error') 
| fields id savedsearch_name, app, user, executed_at, search, messages.*

And you can kinda join this to the _audit query:

index=_audit action=search (has_error_warn=true OR fully_completed_search=false OR info="bad_request")
| eval savedsearch_name = if(savedsearch_name="", "Ad-hoc", savedsearch_name)
| eval search_id = trim(search_id, "'")
| eval search = mvindex(search, 0)
| map search="| rest splunk_server=local /servicesNS/$user$/$app$/search/jobs/$search_id$ 
| where isnotnull('messages.error') 
| fields id savedsearch_name, app, user, executed_at, search, messages.*"

But it doesn't really work - I get lots of rest failures reported and the output is bad. You also need to run it when the search artifacts are present. Although my plan was to run this frequently and push the result to a summary index.

Has anyone had better success with this? One thought would be to ingest the data that is returned by the rest call (I presume var/run/dispatch). Or might debug level logging help?

Labels (1)
0 Karma

somesoni2
Revered Legend

Give this a try

index=_internal source=*var/log/splunk/search_messages.log
0 Karma

jonaclough
Path Finder

Thanks for pointing me to this excellent log source!

I created a search which is intended to exceed the subsearch maxout limit:

index=main [search index=main earliest=-1w | fields host | head 11000 | format]

(I checked the subsearch is over 11000 records) 

This doesn't trigger an error or warning in _audit, _internal or from the GUI

From the limits.conf documentation I see this setting:

maxout = <integer>
* Maximum number of results to return from a subsearch.
* This value cannot be greater than or equal to 10500.
* Default: 10000

So would expect my search to exceed the limit.

I'm now confused as to whether I'm misinterpreted something.

0 Karma

jonaclough
Path Finder

Additional info: you  can see the limit being hit from the job inspector:

jonaclough_0-1698149686155.png

 

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...