Sql-server – Extended Event Session Keeps Stopping

extended-eventssql serversql-server-2012

A few months ago I added an extended event to track blocked processes and deadlocks, with a file output to track occurrences.

Every now and again, I check the log file, but find that the extended event has stopped, when I "Start Session" again through SSMS, it picks up again and logs as expected.

How can I ensure that this runs 24/7?
Is it possibly failing somewhere and there's a log of errors that I'm unaware of?

Output File(s)

Selected Events

Best Answer

It seems your Extended Event session is defined with STARTUP_STATE=OFF so it is not started automatically when SQL Server is restarted.

Change the session to STARTUP_STATE=ON to ensure it's always running (unless stopped manually):

ALTER EVENT SESSION [blocked_process] ON SERVER 
    WITH (STARTUP_STATE=ON);