Splunk Search

Trying to do a Top command per hourly intervals

Johnnerz
Engager

Hi There,

I have a search that shows the top 2 Id's that have the most payments processed in each country. I'm trying to make this search give me these results per hour

The search itself works as expected in the below format, I just want to give the results in an hourly interval instead 

`index` "Payment Status"
| rex "status:(?P<status>APPROVED|DECLINED)"
| search status=APPROVED OR status=DECLINED
| top limit=2 id by country, status

I've tried putting it into a timechart and also using the span but it keeps asking for a function and I don't know how to rewrite the above into hourly spans.

Labels (3)
0 Karma
1 Solution

saravanan90
Contributor

This may help...

`index` "Payment Status"
| rex "status:(?P<status>APPROVED|DECLINED)"
| search status=APPROVED OR status=DECLINED
| bin span=1h _time
| top 2 id by _time country status

View solution in original post

saravanan90
Contributor

This may help...

`index` "Payment Status"
| rex "status:(?P<status>APPROVED|DECLINED)"
| search status=APPROVED OR status=DECLINED
| bin span=1h _time
| top 2 id by _time country status

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...