Please download and install Log Parser if it is not already installed on your system
Log parser download: https://www.microsoft.com/en-us/download/details.aspx?id=24659
Open Command Prompt in Administrator mode.
You should navigate to the Log Parser directory in Command Prompt
cd “C:\Program Files (x86)\Log Parser 2.2”
Script: Change the smtp log path:
\\EXC01\C$\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpReceive\RECV202502*.
Logparser "Select connector-id, remote-endpoint, data FROM '\\EXC01\C$\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpReceive\RECV202502*','\\EXC02\C$\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpReceive\RECV202502*' to C:\Scripts\RelayList.csv where DATA LIKE 'MAIL FROM%'" -i:csv -o:csv -nskiplines:4