SQL Server Alwayson primary replica failed to create diagnostics log.


SQL Server Alwayson diagnostics log is a useful tool to troubleshoot SQL Server Alwayson related issue. It saves the result of stored procedure system stored procedure sp_server_diagnostics (Transact-SQL)  to SQLDIAG file, the naming convention is serverName_instanceName_SQLDIAG_xxx.xel.

This log is only created in SQL Server cluster active node or SQL Server Alwayson Availability group primary replica. Please note, it’s created by RHS.exe instead of SQL Server.

Following screenshot of process monitor shows callstack of creating the diagnostic log by RHS.exe. As you see, RHS.exe, hadrres.dll and xe.dll are used.

 

When SQL Server is installed, it creates hadrres.dll in MSSQLBinn folder and creates