How to clear SQL Server extended events that are stored in a file?
Where are the files for SQL Server Extended Events Event File target stored?
I want to delete months worth of log files; but SQL Server doesn't tell me where the files are:
I would follow the advice on Microsoft's SQL Server forums:
Clear events in file target?
Simply stop the session and delete .xel file if it’s no longer required.
Attempt#3
I tried doing the single most obvious thing that any user interface designer worth their salt would have created from the beginning: Right-click the event file target, and select:
Except there is no option to do any of those obvious things:
Attempt#4
I also tried going into the Extended Events menu, and clicking Clear Data. But the option is inexplicably disabled:
Attempt#5
I also tried to script the Extended Events Session, in order to see where it is storing the files. But of course SQL Server team is not helpful:
ADD TARGET package0.event_file(SET filename=N'Expensive Queries',max_file_size=(25),max_rollover_files=(4)),
Attempt#6
In SQL Server Profiler. If you wanted to clear the events you pushed the button to clear the events:
SQL Profiler is deprecated, and it's replacement provides no way to clear the events.
What is the way to clear the events?
To delete an Excel file through Windows Explorer, go to the folder where your file is saved, and right-click on the file, and choose Delete. As a result, the file is moved to the Recycle Bin. You can do the same thing by selecting the file, and pressing the Delete button on your keyboard.
The regular menu of File > Open > File. Right-clicks in the Object Explorer under Management > Extended Events. The special menu Extended Events, and the special toolbar for Extended Events.
You need a suitable software like SQL Server Mangement Studio to open a XEL file. Without proper software you will receive a Windows message "How do you want to open this file?" or "Windows cannot open this file" or a similar Mac/iPhone/Android alert.
What is SQL Server extended events? SQL Server Extended Events is a performance monitoring tool that helps to collect and monitor the database engine actions to diagnose problems in SQL Server. Microsoft has introduced the extended events with the SQL Server 2008 and then decided to retire the SQL profiler.
By default the path seems like it would be
C:\Program Files\Microsoft SQL Server\MSSQLXX.MSSQLSERVER\MSSQL\Log\*.xel
or basically wherever the system files are kept for SQL Server (i.e. the default ERRORLOG location). If there is nothing there then it may be that your Extended Event is set to ring buffer in which case only the latest information is kept and it's stored in memory. Seems the only way to clear the log in this case would be to stop and start the session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With