

If the data model is accelerated then the new *.tsidx indexed files are created on the indexers at $SPLUNK_DB$//datamodel_summary/_//DM_. Don't do "Last X minutes" since the time range will be different when you run the search ad-hoc. Make sure you use the same fixed time range (ie from X to Y). You can verify that you'll get the exact same count from both the tstats and normal search. The translation is defined by the base search of the DM (under "Constraints"). If the DM isn't accelerated then tstats will translate to a normal search command, so the above command will run: index=_internal source=*scheduler.log* OR source=*metrics.log* OR source=*splunkd.log* OR source=*license_usage.log* OR source=*splunkd_access.log* | stats count Note that I use the DM filename internal_server (ie Object ID), not the "pretty" name. įirst, run a simple tstats on the DM (doesn't have to be accelerated) to make sure it's working and you get some result: | tstats count from datamodel=internal_server Since this seems to be an popular answer, I'll get in even more details:įor our example, let's use the out-of-the-box data model called "Splunk's Internal Server Logs - SAMPLE" at. Generally, I recommend using accelerated data models.

INDEXED_EXTRACTIONS in nf for structured data like CSV.Index-time fields manually via nf, nf, and nf.A namespace created by the tscollect search command.Tstats can run on the index-time fields from the following methods: Since status and username are not index-time fields (they are search-time).

You can do this: | tstats count by index sourcetype sourceīut you can't do this: | tstats count where status>200 by username By default, this only includes index-time fields such as sourcetype, host, source, _time, etc. Since tstats can only look at the indexed metadata it can only search fields that are in the metadata. tsidx files in the buckets on the indexers) whereas stats is working off the data (in this case the raw events) before that command. Tstats is faster than stats since tstats only looks at the indexed metadata (the.
