Splunk Search

Why search can return 200 result but stats count by host shows 0 result

mind1n
Engager

I used query index=testindex _raw=* and successfully returned 200+ result.

However, when I added stats index=testindex _raw=* | stats count by host, no result returned.

Is there anything missing when I use stats command?

Below is the splunk search result of the 1st query (without stats):

 21/02/11 21:23:45.000
 
2021_2_10-15_0_0_,1274423072.0
 21/02/11 21:23:45.000
 
2021_2_10-14_59_0_,1274423072.0
 21/02/11 21:23:45.000
 
2021_2_10-14_58_0_,1274423072.0
Labels (1)
Tags (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust
And in this case it’s even better to use
|tstats count where index=testindex by host

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @mind1n,

probably the problem is that you're running the search in Fast mode, so if you don't use stats, by default Splunk uses the Verbose Mode, instead, using stats, probably it uses the Fast Mode.

Try to use the Verbose Mode.

Then, try to cut _raw=* (that's unuseful) and your search (with stats) should run also in fast mode, because host is a field usable in Fast Mode.

Ciao.

Giuseppe

0 Karma

isoutamo
SplunkTrust
SplunkTrust
And in this case it’s even better to use
|tstats count where index=testindex by host
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...