Splunk Search

Top 10 for every timespan

AshimaE
Explorer

I have data of mail sending activities of 1000s of customers and need to find the top 10 mail sending customers for every 10minutes for the customer data of the past 1 month. I need to create a stacked chart of the same. Any suggestions how this could be done. for the past 24hrs the top customers have been found as follows

 index=campaign_prod sourcetype=witness_stat_log virtualization=* earliest=-1d | dedup host| table host customer_name | join type=outer host [search index=campaign_prod sourcetype=mtachild_log message_type=info "sent"| stats count as email_count by host] | fillnull value=0 email_count | stats sum(email_count) as mail_count by customer_name | sort 0 -mail_count | head 20
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi AshimaE,
try something like this

index=campaign_prod sourcetype=witness_stat_log virtualization=* earliest=-1d 
| dedup host
| join type=outer host [ search 
    index=campaign_prod sourcetype=mtachild_log message_type=info "sent" 
   | stats count as email_count by host 
   ] 
| fillnull value=0 email_count 
| bin span=10m _time
| stats sum(email_count) as mail_count by customer_name, _time 
| sort 0 -mail_count 
| head 20

Bye.
Giuseppe

0 Karma

AshimaE
Explorer

But this will give the top 20 overall while I want the top 10 or 20 for each timespan of the 1 month period.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...