Before going into the scenario, it is a good idea to understand how the data model acceleration (DMA) works.
When a data model is accelerated, Splunk runs background search at a regular interval to create data summaries based on the constraint specified within the data model's dataset(s). For example, when index=main is used as the constraint, the background search will create data summaries against buckets from the main index only.
The amount of summarised data kept at any one time depends on the backfill range and the summary range. In any case, the amount of summarised data will never exceed the amount of the original raw data.
Theoretically speaking, therefore, running the tstats command with summariesonly=true switch (to return only the summarised data) should never cause Splunk to scan more buckets than when the summariesonly=false switch is used.
Consider the following scenario:
withlookup had a root event dataset with the following constraint: `testindex`testindex was a macro that expands to: [| inputlookup test.csv]tstats command against the accelerated data model, the following behaviour was seen: both summariesonly options returned a similar event count, however, the summariesonly=true option scanned significantly more buckets (as seen from the search's Job Inspector).
Search Head's search.log with summariesonly=f (false):
This is also called a mixed-mode search. In the below example, the search was treated more traditionally to take into account the fallback search portion (i.e. the non-accelerated search that covers the timespan outside of the summary range). The subsearch was processed first and the correct list of eligible buckets was returned.
11-17-2024 11:05:06.283 INFO SearchParser [799390 searchOrchestrator] - PARSING: | tstats count from datamodel=withlookup summariesonly=f | noop log_debug=* log_appender="searchprocessAppender;maxFileSize=50000000;maxBackupIndex=99;maxMessageSize=10000000" set_ttl=30m11-17-2024 11:05:06.287 DEBUG DataModelEvaluator [799390 searchOrchestrator] - Trying to load model 'withlookup'
11-17-2024 11:05:06.287 INFO SearchParser [799390 searchOrchestrator] - PARSING: search `testindex`
11-17-2024 11:05:06.288 INFO SearchParser [799390 searchOrchestrator] - AFTER EXPANDING MACROS: search [|inputlookup test.csv]
11-17-2024 11:05:06.290 DEBUG SearchParser [799390 searchOrchestrator] - Macro expansion step: | search (index=* OR index=_*) ([|inputlookup test.csv]) | eval nodename = "withlookup"
11-17-2024 11:05:06.292 INFO TsidxStats [799390 searchOrchestrator] - Using summaryid="74797DC2-63B8-45AF-B67F-98D71FC1F57E_DM_search_withlookup"
11-17-2024 11:05:06.292 DEBUG TsidxStats [799390 searchOrchestrator] - Building fallback search for name=tstats args=prestats=t, local=f, summariesonly=f, allow_old_summaries=f, chunk_size=10000000, count, from, datamodel=withlookup prestats_cmd=prestats count11-17-2024 11:05:06.318 DEBUG AstOptimizer [799390 searchOrchestrator] - Pre-optimization search=" | tstats summariesonly=false allow_old_summaries=false count FROM datamodel=withlookup | noop log_debug=* log_appender=\"searchprocessAppender;maxFileSize=50000000;maxBackupIndex=99;maxMessageSize=10000000\" set_ttl=30m"11-17-2024 11:05:06.342 INFO TsidxStats [799390 searchOrchestrator] - Could not obtain a valid set of indexes to search11-17-2024 11:05:06.354 INFO AstOptimizer [799400 localCollectorThread] - Original Search = search (index=* OR index=_*) ([|inputlookup test.csv]) | eval nodename = "withlookup" | addinfo type=count label=prereport_events track_fieldmeta_events=true | prestats count11-17-2024 11:05:06.354 INFO AstOptimizer [799400 localCollectorThread] - Search optimization skipped. Reason="Query has subsearch" query=" search (index=* OR index=_*) ([|inputlookup test.csv]) | eval nodename = "withlookup" | addinfo type=count label=prereport_events track_fieldmeta_events=true | prestats count"11-17-2024 11:05:06.354 DEBUG DispatchManager [799400 localCollectorThread] - Create SearchOrchestrator to run subsearch.11-17-2024 11:05:06.363 DEBUG SearchOperator:inputcsv [799411 phase_1] - Input csv file: /opt/splunk/etc/apps/search/lookups/test.csv11-17-2024 11:05:06.363 INFO SearchOperator:inputcsv [799411 phase_1] - SearchMessage orig_component=SearchOperator:inputcsv sid=subsearch_1731841506.130_1731841506.5 message_key=INPUT_CSV:LOOKUP_READ__%s message=Successfully read lookup file '/opt/splunk/etc/apps/search/lookups/test.csv'.11-17-2024 11:05:06.363 DEBUG SearchProcessor [799411 phase_1] - execute_dispatch - Post-execute - processor="inputlookup" type="SP_REPORT" results_estimate_heap_usage=409600 results_size=16 results_num_files=011-17-2024 11:05:06.369 DEBUG SearchProcessor [799400 localCollectorThread] - SearchMessage orig_component=SearchProcessor sid=1731841506.130 message_key=SEARCHPROC:SUBSEARCH_ARG__%s message=Subsearch evaluated to the following search expression: ( ( index="_internal" AND sourcetype="first_install-too_small" ) OR ( index="_internal" AND sourcetype="mongod" ) OR ( index="_internal" AND sourcetype="scheduler" ) OR ( index="_internal" AND sourcetype="secure_gateway_app_internal_log" ) OR ( index="_internal" AND sourcetype="splunk_assist_internal_log" ) OR ( index="_internal" AND sourcetype="splunk_python" ) OR ( index="_internal" AND sourcetype="splunk_search_messages" ) OR ( index="_internal" AND sourcetype="splunk_version" ) OR ( index="_internal" AND sourcetype="splunk_web_access" ) OR ( index="_internal" AND sourcetype="splunk_web_service" ) OR ( index="_internal" AND sourcetype="splunkd" ) OR ( index="_internal" AND sourcetype="splunkd_access" ) OR ( index="_internal" AND sourcetype="splunkd_conf" ) OR ( index="_internal" AND sourcetype="splunkd_remote_searches" ) OR ( index="_internal" AND sourcetype="splunkd_stderr" ) OR ( index="_internal" AND sourcetype="splunkd_ui_access" ) )11-17-2024 11:05:06.445 DEBUG TsidxStats [799400 localCollectorThread] - Prefetch H/S/ST and bloom filters for bucket: bid=_internal~0~74797DC2-63B8-45AF-B67F-98D71FC1F57E
11-17-2024 11:05:06.445 DEBUG TsidxStats [799400 localCollectorThread] - Prefetch H/S/ST and bloom filters for bucket: bid=_internal~1~74797DC2-63B8-45AF-B67F-98D71FC1F57E
11-17-2024 11:05:06.445 DEBUG TsidxStats [799400 localCollectorThread] - Prefetch H/S/ST and bloom filters for bucket: bid=_internal~2~74797DC2-63B8-45AF-B67F-98D71FC1F57E
11-17-2024 11:05:06.445 DEBUG TsidxStats [799400 localCollectorThread] - Prefetch H/S/ST and bloom filters for bucket: bid=_internal~3~74797DC2-63B8-45AF-B67F-98D71FC1F57E
11-17-2024 11:05:06.445 DEBUG TsidxStats [799400 localCollectorThread] - Prefetch H/S/ST and bloom filters for bucket: bid=_internal~4~74797DC2-63B8-45AF-B67F-98D71FC1F57E
11-17-2024 11:05:06.445 DEBUG TsidxStats [799400 localCollectorThread] - Prefetch H/S/ST and bloom filters for bucket: bid=_internal~5~74797DC2-63B8-45AF-B67F-98D71FC1F57E
11-17-2024 11:05:06.445 INFO TsidxStats [799400 localCollectorThread] - Pipeline id=0, buckets used=6/6, checkIndexTime=f, checkMetaData=f, checkBloomFilter=f, terms=0
11-17-2024 11:05:06.446 DEBUG TsidxStats [799400 localCollectorThread] - bloom_eliminated_count=0, meta_eliminated_count=0, bloom_eliminated_rawsize=0, searched_buckets=6
11-17-2024 11:05:06.446 INFO TsidxStats [799400 localCollectorThread] - Sorting 6 buckets in time descending order11-17-2024 11:05:06.452 DEBUG TsidxStats [799400 localCollectorThread] - Preparing to read summaryId="74797DC2-63B8-45AF-B67F-98D71FC1F57E_DM_search_withlookup"
Search Head's search.log with summariesonly=t (true):
The search orchestrator process detected the macro and expanded the content accordingly. In the below example, the macro expanded to [|inputlookup test.csv], which contained both a subsearch and a pipe. Both subsearch and/or pipe are not allowed in a data model search constraint. Consequently, the buckets were scoped based on the search timespan but not the indexes. The search then fetched buckets from all the indexes that matched the timespan.
For each bucket, Spunk checked whether it contained the summary ID needed to fulfil the search request, and if not, it was ignored. The final search result was correct, however, the search went through a very inefficient cycle.
11-17-2024 11:03:49.311 INFO SearchParser [798599 RunDispatch] - PARSING: | tstats count from datamodel=withlookup summariesonly=t | noop log_debug=* log_appender="searchprocessAppender;maxFileSize=50000000;maxBackupIndex=99;maxMessageSize=10000000" set_ttl=30m11-17-2024 11:03:49.316 DEBUG DataModelEvaluator [798602 searchOrchestrator] - Trying to load model 'withlookup'
11-17-2024 11:03:49.316 INFO SearchParser [798602 searchOrchestrator] - PARSING: search `testindex`
11-17-2024 11:03:49.316 INFO SearchParser [798602 searchOrchestrator] - AFTER EXPANDING MACROS: search [|inputlookup test.csv]11-17-2024 11:03:49.317 DEBUG DataModelObject [798602 searchOrchestrator] - DataModelObject::searchTree() for object withlookup returned | search (index=* OR index=_*) (`testindex`) | eval nodename = "withlookup"
11-17-2024 11:03:49.317 DEBUG SearchParser [798602 searchOrchestrator] - Macro expansion step: | search (index=* OR index=_*) ([|inputlookup test.csv]) | eval nodename = "withlookup"11-17-2024 11:03:49.366 INFO TsidxStats [798602 searchOrchestrator] - Using summaryid="74797DC2-63B8-45AF-B67F-98D71FC1F57E_DM_search_withlookup"
11-17-2024 11:03:49.366 DEBUG TsidxStats [798602 searchOrchestrator] - Building fallback search for name=tstats args=prestats=t, local=f, summariesonly=t, allow_old_summaries=f, chunk_size=10000000, count, from, datamodel=withlookup prestats_cmd=prestats count
11-17-2024 11:03:49.366 INFO TsidxStats [798602 searchOrchestrator] - Could not obtain a valid set of indexes to search11-17-2024 11:03:49.397 DEBUG SummaryBucket [798612 localCollectorThread] - Successfully loaded metadata from csv. summary=summaryId=74797DC2-63B8-45AF-B67F-98D71FC1F57E_DM_search_withlookup summaryPath=/opt/splunk/var/lib/splunk/_internaldb/datamodel_summary/5_74797DC2-63B8-45AF-B67F-98D71FC1F57E/74797DC2-63B8-45AF-B67F-98D71FC1F57E/DM_search_withlookup bucketId=_internal~5~74797DC2-63B8-45AF-B67F-98D71FC1F57E tstats=111-17-2024 11:03:49.398 DEBUG BucketSummaryMetadata [798612 localCollectorThread] - Summary metadata file does not exist: /opt/splunk/var/lib/splunk/_configtracker/datamodel_summary/3_74797DC2-63B8-45AF-B67F-98D71FC1F57E/74797DC2-63B8-45AF-B67F-98D71FC1F57E/DM_search_withlookup/metadata.csv
11-17-2024 11:03:49.398 DEBUG SummaryBucket [798612 localCollectorThread] - Failed to initialize metadata. summary=/opt/splunk/var/lib/splunk/_configtracker/datamodel_summary/3_74797DC2-63B8-45AF-B67F-98D71FC1F57E/74797DC2-63B8-45AF-B67F-98D71FC1F57E/DM_search_withlookup
11-17-2024 11:03:49.398 DEBUG SummaryBucket [798612 localCollectorThread] - SummaryBucket cache_id="dma|_configtracker~3~74797DC2-63B8-45AF-B67F-98D71FC1F57E|74797DC2-63B8-45AF-B67F-98D71FC1F57E_DM_search_withlookup" local=1 hot=1 done=0 summary state=1 remoteStorageEnabled=0
The data model editor has a sanity check to prevent the use of subsearch and/or pipe in a data model constraint:


If the subsearch and/or pipe are wrapped inside a macro, the data model editor's sanity check does not check for their existence, however, it does warn that there is no explicit index constraint.

The data model can be saved and run normally because the summary-generating search does process the search query like a traditional search, however, this creates complications when it is time to search as described in the investigation section.
Recommendations:
To ensure that the tstats with summariesonly=true only scans buckets from specific indexes, the data model search constraint must contain a regular index definition. The constraint also allows additional basic search terms as described in the documentation.
| Revision | Publish Date | Comments |
|---|---|---|
1.0 |
29-Sep-2026
|
Initial Release |