I have a search that evaluates email events (given a specific subject) to count the number of recipients per individual email and then sum the total number of recipients from all emails (given the same subject). The search also looks for recipients on a watch_list.csv with a flag to create a yes or no value next to the watched emailaddress.
Now I need a column (totalonwatch_list) with the total number of "yes" recipients.
index=mail sourcetype=xemail [search index=mail sourcetype=xemail subject = "Blah" |stats count by UID| fields UID]
|stats list(subject) as subj list(sender) as sender list(recipient) as recp list(vendor_action) as status by UID
|lookup watch_list.csv emailaddress as recp OUTPUT flag emailaddress
| fields - flag
|eventstats sum(recp_count) as total_recipients