Increasing SQL Server Error Logs

(Originally posted on my personal blog.)

Via Tim Radney, here’s a quick and easy way to increase the number of error logs from the default of six.

His blog has a walkthrough in SQL Server Management Studio if you prefer the GUI.

Using TSQL you can execute the following statement to increase to 99 files, simply change 99 to how ever many files you would like to retain.

USE [master];
GO


EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', REG_DWORD, 99;
GO