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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...