Splunk Search

How to count every 15mins with complete time bucket

Anita
Engager

If I use bin _time as time span=15m | stats count by time on 17:20 for the past 1 hour, the result would be like

...

time interval      count

16:45 - 17:00    1285

17:00 - 17:15    1352

17:15 - 17:20    362

So for the last time bucket which is incomplete, there will be only 5 mins data.

Is there any way to search every 15mins backward from the current time like 

...

16:35 - 16:50

16:50 - 17:05

17:05 - 17:20

Really appreciate your help!

 

 

Labels (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @Anita,

you have to use the aligntime=latest in your bin command, something like this:

your_search
| bin _time as time span=15m aligntime=latest
| stats count by time 

as you can see at https://docs.splunk.com/Documentation/SplunkCloud/8.2.2111/SearchReference/Bin

Ciao.

Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Anita,

you have to use the aligntime=latest in your bin command, something like this:

your_search
| bin _time as time span=15m aligntime=latest
| stats count by time 

as you can see at https://docs.splunk.com/Documentation/SplunkCloud/8.2.2111/SearchReference/Bin

Ciao.

Giuseppe

0 Karma

Anita
Engager

That works! 

Thank you so much for your help!

0 Karma

gcusello
SplunkTrust
SplunkTrust

HI @Anita,

good for you, see next time!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...