Splunk Search

Email regex from mail.log to extract 2 email addresses, display them in a table?

devtech83
Engager

I have mail.log. This is displayed in the "Event" column:

 

 

May 24 14:02:05 srv7 amavis[10129]: (10129-08) Passed CLEAN {RelayedInbound}, [IP]:59703 [IP] <email@email.com> -> <first.last@domain.com>, Queue-ID: CC8511E237D, Message-ID: <ID@domain.com>

May 24 13:37:34 srv7 amavis[10129]: (10129-03) Passed CLEAN {RelayedOutbound}, LOCAL [IP]:40060 <first.last@domain.com> -> <email@email.com>, Queue-ID: E61E71E237D, Message-ID: <ID@domain.com>

May 24 13:45:32 srv7 amavis[10129]: (10129-04) Passed CLEAN {RelayedInbound}, [IP]:14208 [IP] <email@email.com> -> <first.last@domain.com>, Queue-ID: E5C8B1E237D, Message-ID: <ID@domain.com>

 

 

I wish to extract the 2 email address, display them in a table and count how many emails each email address has.

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex "<(?<fromaddress>[^@]+@[^>]+)> -> <(?<toaddress>[^@]+@[^>]+)>"
| stats count by fromaddress toaddress

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex "<(?<fromaddress>[^@]+@[^>]+)> -> <(?<toaddress>[^@]+@[^>]+)>"
| stats count by fromaddress toaddress
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...