Query to determine XE Session status

On a previous post, we discussed what is an extended event (XE) and how to create one.

With the following T-SQL you can quickly check what are the currently running Extended Events sessions:



SELECT 
 ES.name,
 iif(RS.name IS NULL, 0, 1) AS running
FROM sys.dm_xe_sessions RS
RIGHT JOIN sys.server_event_sessions ES ON RS.name = ES.name
--WHERE es.name = '<YOUR XE SESSION NAME>'



The column running will show 0 if the session is currently stopped and 1 if it is currently running.
In the commented WHERE clause, you can filter for a specific session.

Hope this helps you to monitor your XE sessions!

Comments