This script will pull message trace logs and output them to JSON, in order to be ingested/parsed by a SIEM
When running this script, it iwll connect out to M365, and pull message trace logs for the dates/times it does not already have a log for.
Meta data on email. To/From, Subject, IP Addresses
Powershell and Windows.
None.
Update the two JSON config files Authentication.json and MessageTraceConfiguration.json
.\getmessagetracelogs.ps1
Not all message logs are pulled. this is due to M365 not having the log available when we pull it. If you want to ensure more logs are pulled, change line #36 to only collect after 6 hours (-1 to -6).