Sql-server – How to access ETW Traces on SQL Server for linux

extended-eventslinuxsql server

I have SQL Server running in a docker image. I have an extended event session running on it. I can connect to it fine and view live data with SSMS. I can use T-SQL to view the histogram target. If this was a windows box, I could use logman.exe to view and manage the event trace session. How do I do it in SQL Server for Linux?

I am absolutely sure that the ETW is getting created.

SELECT
    xes.name AS [Session Name],
    CAST(xest.target_data AS xml) [Histogram XML],
    xest.target_name
    FROM sys.dm_xe_session_targets xest  
    INNER JOIN sys.dm_xe_sessions xes ON xes.address = xest.event_session_address  
    WHERE xest.target_name = 'etw_classic_sync_target';


<ETWTarget truncated="0">
<DefaultETWSession>
<Name>XE_DEFAULT_ETW_SESSION</Name>
<Path>C:\Users\Client\Temp\XEEtw.etl</Path>
<BufferSizeKb>128</BufferSizeKb>
<FileSizeMb>20</FileSizeMb>
</DefaultETWSession>
<DefaultXESession>
<Name>XE_DEFAULT_ETW_SESSION</Name>
</DefaultXESession>
</ETWTarget>

However, if I execute find / -iname XEEtw.etl inside bash on the docker container I get no results. I know that SQL Server on Linux is running its own internal copy of Windows NT. I just don't know if that ETW is exposed.

Best Answer

How do I access ETW Traces on SQL Server for linux?

Unfortunately, ETW (Event Tracing for Windows) is not available on Linux. It is a Windows-only function. So for the time being you are stuck with the SQL and filesystem options for view the EE data.

The .NET Core team chose LTTng for trace support when .NET apps are running on Linux. You could explore that as an option for correlating OS events with those recorded by SQL Server.


After your update (super interesting that ETW events might be firing in Drawbridge), I see that the .etl file is getting created on a file path that probably doesn't exist on your Linux-based Docker container. You should try setting a known-good file path when you create the XE session:

ADD TARGET package0.etw_classic_sync_target   
    (SET default_etw_session_logfile_path = N'/temp/sqletw.etl' )