Splunk Search

How do I calculate the number of server requests in the last 2 minutes?

rajhemant26
New Member

Hello everyone.

Want to display the output only for the time which crosses 18 months (earliest time)

Tags (1)
0 Karma

renjith_nair
Legend

@rajhemant26,

If you just want the count for last 2 minutes, set the earliest time to last 2 minutes relative to current time and do a stats count on the data,
For eg.

host=werdw* sourcetype=dfgc_metric R=* earliest=-2m@m 
| eval host_type=case(host LIKE "%wap%", "WAP", host LIKE "%web%", "WEB", host LIKE "%task%", "TASK", 
                 host LIKE "%iin%", "IIN", host LIKE "%gen%", "GEN", host LIKE "%ion%","ION", 
                 host LIKE "%int%", "INT", host LIKE "%out%", "OUT", host LIKE "%rpt%", "RPT", 
                 host LIKE "%rpo%", "RPO", 1=1, "Other") 
| stats count as Request by host_type

You need to use bin/bucket only if you want to split the data into time bukcet of 2 mins for the last x minutes/hours.
streamstats is used when you need a moving sum/avg/otehr agg functions over data

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...