How to clear SQL Server extended events that are stored in a file?
Background
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:
- Clear
- Delete
- Purge
- Empty
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?