logo
SQL Server Increase or decrease SQL Server ErrorLog number

How to Manage Number of SQL Server ErrorLog

By Hally | Last Updated

Microsoft SQL Server saves 7 errorlog files by default. When new errorlog is created, the old one will be deleted at the same time. If you want to keep more errorlog, you can follow two ways below to manage number of SQL Server ErrorLog, including both increasing and decreasing ErrorLog number.

Way 1: Configure SQL Server ErrorLog Number in SSMS

Step 1: Open SQL Server Management Studio. Connect to SQL Server with SQL Server Authentication.

connect to SQL Server with SQL Server Authentication

Tips: If SA account password forgot, you could only reset SA password or change SA forgotten password. And then login to SQL Server with SQL Server Authentication and new SA password. Otherwise, even though you can successfully connect to SQL Server with Windows Authentication, the following error still occurs as soon as you want to configure SQL Server logs.

error when configure SQL Server logs

Step 2: Navigate to Management SQL Server Logs. Right-click on SQL Server Logs and choose Configure.

configure SQL Server ErrorLog

Step 3: In pop-up window Configure SQL Server Error Logs, tick the box "Limit the number of error log files before they are recycling". And set "Maximum number of error log" with willing number. Save changes at last before you close this window.

limit number of SQL Server ErrorLog file

Way 2: Change Number of SQL Server ErrorLog in Registry Editor

Step 1: Type regedit in Start box, and press Enter to run Registry Editor.

Step 2: Locate to the following path(1 or 2) and create a new entry in registry editor.

1. Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer

2. Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ MSSQLServer\MSSQLServer

Right-click in the right blank pane of registry editor, and tap New QWORD (64-bit) Value button in pop-up options.

create new entry NumErrorLogs in registry editor

Step 3: Rename the entry as NumErrorLogs and double-click it to edit its value. Type a number that you want to save SQL Server ErrorLog file. Tick Decimal under Base and click OK.

set value data for NumErrorLogs entry

Close Registry Editor and finish setting on increasing or decreasing number of SQL Server ErrorLog file.

successfully change number of SQL Server ErrorLogs file in registry editor

Related Articles: