Hey David!
Here's a proof-of-concept to determine which buckets are accessed for each search. The approach is rather low-level, Linux specific, and has several rough edges. (Aka, don't try this on production). Disclaimers aside, I think it may give you the kind of answers you are looking for, or at least provide a jumping-off point.
In Splunk 6 (and possibly earlier), there's a settings called search_process_mode which allows "debugging" all search commands. Essentially, this allows you to run an arbitrary command instead of the normal splunkd search ... process. So basically we can drop in a debugging script to intercept the new search request and then run the standard worker process. This proof of concept uses the strace command to tracks file activity, which includes every open() call to each bucket. The file activity gets dumped to a strace.log file thrown into the dispatch folder.
Here's the basic setup:
inputs.conf:
[monitor://$SPLUNK_HOME/var/run/splunk/dispatch]
index = _internal
whitelist = strace\.log$
sourcetype = splunk_search_strace
limits.conf:
[search]
search_process_mode = debug search-perf.sh
$SPLUNK_HOME/bin/scripts/search-perf.sh
#!/bin/bash
shift
search_id=`echo "$*" | sed -re 's/.* --id=([^ ]+).*/\1/'`
echo "`date` [${search_id}] START SEARCH ARGS: $*" >> $SPLUNK_HOME/var/log/splunk/search-perf.log
strace -ttt -f -e trace=file $SPLUNK_HOME/bin/splunkd $* 2> $SPLUNK_HOME/var/run/splunk/dispatch/${search_id}/strace.log
echo "`date` [${search_id}] END SEARCH" >> $SPLUNK_HOME/var/log/splunk/search-perf.log
Here's an example search that shows a list of indexes and buckets accessed per search:
index=_internal sourcetype=splunk_search_strace open (merged_lexicon OR .tsidx OR Hosts.data OR Sources.data OR Sourcetypes.data)
| rex field=source "/dispatch/(?<sid>[^/]+)/"
| rex "open\(\"(?<path>[^\"]+)\","
| rex field=path "/(?<idx>[^/]+)/(?<phase>[^/]+)/(?<bkt>[^/]+)/[^/]+$"
| transaction sid
| table sid, path, duration, idx, phase, bkt
Right now you can use this to see what buckets are being accessed, but I think you could expand the example search to see which buckets are scanned (in other words, add some logic looking for open calls to 'rawdata/journal.gz' rather than just open calls to tsidx files; I'm guessing you could also look at the effectiveness of bloom filters using this technique too). I'm sure there's a way to get statistics on IO usage if you (or someone you know) has voodoo strace skills to determine times take per read and amount of data accessed.
Other random notes
I found out that you can just run strace without redirecting stderr to a log file and it shows up in the splunkd.log. (Search for "ProcessDispatchedSearch - PROCESS_SEARCH") I thought about using this approach, but then you can't tell which search the message came from. Additional, using the dispatch folder has the advantage of using Splunk's default job aging behavior to cleanup work for us.
Also, I saw in the docs a new setting in Splunk 6.1 that looks promising, but I couldn't locate where these new metrics go. But I could have been looking in the wrong location.
limits.conf:
[search_metrics]
debug_metrics = true
This may be worth a second look.
... View more