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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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