Splunk Search

stats count by _time

pinzer
Path Finder
stats count by _time 

Hi all, I've a query where i count by _time but if in a day there aren't events it is not show in the count. How can i see also a date with zero events? thanks

Tags (1)
0 Karma
1 Solution

Dan
Splunk Employee
Splunk Employee

With the stats command, the only series that are created for the group-by clause are those that exist in the data. If you have continuous data, you may want to manually discretize it by using the bucket command before the stats command. If you use span=1d _time, there will be placeholder values created for empty days and all other _time values will be snapped to the day.

All of this is done for you automatically in the timechart command.

View solution in original post

0 Karma

Dan
Splunk Employee
Splunk Employee

With the stats command, the only series that are created for the group-by clause are those that exist in the data. If you have continuous data, you may want to manually discretize it by using the bucket command before the stats command. If you use span=1d _time, there will be placeholder values created for empty days and all other _time values will be snapped to the day.

All of this is done for you automatically in the timechart command.

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

  🚀 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 ...