Complete a Server Assessment – Extended Event Session Information

 

Below you will find the code to return information about Extended Event Sessions.  Simply select the text and copy to the Clipboard.

SELECT
s.name AS ‘SessionName’
, e.name AS ‘EventName’
, e.predicate
, a.name AS ‘ActionName’
, t.name AS ‘TargetName’ 
FROM sys.server_event_sessions s
INNER JOIN sys.server_event_session_events e
ON s.event_session_id = e.event_session_id
INNER JOIN sys.server_event_session_actions a
ON s.event_session_id = a.event_session_id
INNER JOIN sys.server_event_session_targets t
ON s.event_session_id = t.event_session_id
WHERE s.name NOT IN (‘system_health’, ‘telemetry_xevents’, ‘ADS_TSQL_OnPrem’, ‘ADS_Standard_OnPrem’)

This code was written using the Microsoft SQL Server documentation.  If you find that this code was copied from else where, please let me know so I can give proper credit.