In your search, you’re attempting to table the _time field when _time is not included as a field after your stats command, and also trying to create a timechart without the _time field as an included field after your stats command. You will not be able to retain that table after piping to a timechart. Not sure if you wanted a table or a timechart? Since your final pipe is to a timechart, I went with that first.
If you want the total emails sent per user per day with a timechart, try this:
index=exchange NOT Status=Quarantined NOT Status=Failed SenderAddress=*.xyz.com
| timechart span=1d dc(RecipientAddress) AS recipient_count by SenderAddress
This should provide you with a timechart of the distinct count of recipients by the sender with a span of 1 day over whatever time period you choose.
I noticed you are searching on exchange, and also specifying a wildcard on the SenderAddress field with the domain, which I interpreted as you wanting to look at a sender(s) email activity from a domain. With an index like exchange, depending on the size of your organization, this timechart might be difficult to read if you don’t specify a sender or a domain. The results in the timechart will truncate if you have more than 1000 senders in the timeframe.
Now, if you didn’t want a timechart and instead want a table with the information from the sender, try something like this:
index=exchange NOT Status=Quarantined NOT Status=Failed SenderAddress=*.xyz.com
| stats count(RecipientAddress) AS recipient_total, values(Subject) AS Subject, values(MessageId) AS MessageId, values(Size) AS Size by SenderAddress
| table SenderAddress, recipient_total, Subject, MessageId, Size
Counting the values of time for the search above can get messy since it will just group all the times together, but you could try using a function like first(_time) or last(_time) in front of the values if you want to know when the oldest or newest event occurred. For example,
index=exchange NOT Status=Quarantined NOT Status=Failed SenderAddress=*.xyz.com
| stats count(RecipientAddress) AS recipient_total, first(_time) AS _time, values(Subject) AS Subject, values(MessageId) AS MessageId, values(Size) AS Size by SenderAddress
| table _time, SenderAddress, recipient_total, Subject, MessageId, Size
This would give you the most recent event’s time out of all the events.
... View more