Splunk Search

How to to take median of number of users logged in past 1 hour 

Rocky31
Path Finder

index=XXX sourcetype="XXX-log" opName="LoginUser"    earliest=-60m latest=now()   | bucket _time span=10m | timechart  count

Any help would be appriciated 🙂

0 Karma

elliotproebstel
Champion

Based on how you've written your test query above, I think you're saying you want to count the number of user login events per every ten minutes in the last hour and then find the median of those counts. If so:

index=XXX sourcetype="XXX-log" opName="LoginUser"    earliest=-60m latest=now()
| bin _time span=10m
| stats count by _time
| stats median(count) as median_count
0 Karma

Rocky31
Path Finder

Thanks much for the help 🙂

can you also guide me on how to take median of 2 weeks (current and last week ) of past 1 hr values on same day of the week.

index=XXX sourcetype="XXX-log" opName="LoginUser" earliest=-60m latest=now() | bin _time span=10m | stats count by _time | stats median(count) as median_count | appendcols [search index=XXX sourcetype="XXX-log" opName="LoginUser" earliest=-10140m latest=-10080m | bucket _time span=10m |timechart count as LastWeek

0 Karma
Get Updates on the Splunk Community!

Splunk Search APIを使えば調査過程が残せます

   このゲストブログは、JCOM株式会社の情報セキュリティ本部・専任部長である渡辺慎太郎氏によって執筆されました。 Note: This article is published in both Japanese ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...