Locating SQL Server logs is essential for diagnosing performance issues, auditing security events, and ensuring business continuity. By default, SQL Server writes error logs and agent logs to the LOG directory of the instance path, typically under \Program Files\Microsoft SQL Server . Understanding the exact file system location helps administrators review historical events without relying solely on graphical tools.
Default Error Log Location by Version
The physical path depends on the Windows account that runs the SQL Server service and the version installed. Administrators often query the error log directly to reveal the current directory without navigating the file system manually. Below are common default paths for recent versions.
SQL Server 2019 and 2017
C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Log
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log
SQL Server 2016 and Earlier
C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log
Finding the Path Using SQL Server Management Studio
You can confirm the active error log location from within SQL Server Management Studio by executing system stored procedures. This method is reliable because it queries the running instance directly, eliminating guesswork. The results display the current path, including the timestamped log files used for rotation.
Using T-SQL to Retrieve the Log Path
Run the following command in a query window to return the error log file path without opening the filesystem.
Command | Description
EXEC xp_readerrorlog 0, 1; | Returns the current error log file location and archived log files.
SQL Server Agent Logs and Custom Directories
SQL Server Agent maintains its own set of logs, which are separate from the error logs. These files are typically located in the same Log folder as the error logs but are prefixed with SQLAGENT . Some organizations redirect logs to a custom directory for centralized monitoring, which requires validating the SQL Server Agent startup parameters or the registry settings for the ErrorLog key.
Viewing the Logs with Command Prompt
Power users often rely on command-line utilities to verify paths quickly. Using dir and findstr , you can search for recent log entries directly in the console. This approach is helpful when graphical access is restricted or when scripting automated diagnostics across multiple servers.
Troubleshooting Missing or Rotated Logs
Log rotation settings in SQL Server manage file size and count, which can result in older logs being renamed or deleted. If you cannot find a specific error entry, check for numbered extensions such as ERRORLOG.1 or ERRORLOG.2 . Understanding the retention policy ensures that critical audit data is not overwritten prematurely.