Splunk Search

top senders by number of attachments

moayadalghamdi
Path Finder

hello splunker !

 

in splunk, i want to print top email sender by the number of attachment, my command is:

index=emaileventtype="email-events" action=delivered | top 10 sender by AttachCount

but it produces more fields and they aren't sorted, like this:

moayadalghamdi_1-1613905737482.png

and as you can see that it produced more than 10 values

i've also tried:

index=emaileventtype="email-events" action=delivered | top 10 sender by AttachCount
| stats sum(AttachCount) as AttachCount by sender
| top 10 AttachCount

 

and here's the result:

moayadalghamdi_2-1613905989211.png

 

 

please help me, i need two fields only, top sender by AttachCount 

 

 

Thanks

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Your by clause on the top command is grouping then getting the top within each group, which doesn't sound like what you are after. Try something like this

index=emaileventtype="email-events" action=delivered 
| stats sum(AttachCount) as AttachCount by sender
| sort 10 -AttachCount

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Your by clause on the top command is grouping then getting the top within each group, which doesn't sound like what you are after. Try something like this

index=emaileventtype="email-events" action=delivered 
| stats sum(AttachCount) as AttachCount by sender
| sort 10 -AttachCount
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...