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
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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...