Im trying to count how many events by category per email domain and do a total of events going to each domain. My query looks like this (note I macroed all the different email domains)
sourcetype=mysearch `myemail`
| stats values(Dst_Email_Domain) AS Email_Domain count by Name
| sort - count
| stats list values(Name) sum dc(Name) by Email_Domain
| sort - sum(count)
| rename "list(Name)" TO Category, list(count) TO Count, sum(count) TO Total
| fields Email_Domain, Category, Count, Total
So this gives me 4 columns: Email_Domain, Category, Count, Total. I get a count in Category for each domain but the count is the same for each item in category e.g. invoice=50, customer bill=100, credit card=75 across all email domains. the Totals seems right, but I can't get the individual events in the category field to count right per each domain. (hope that explains it)
... View more