SQL Server Health Check

[4 ways] How To Check SQL Server Error Log Location?

Updated
4 min read
Written by
Mark Varnas

4 step by step methods to find SQL Server error log location

You can check the SQL Server error log path in a few ways:

  1. Use T-SQL
  2. Use SQL Configuration Manager
  3. Use Event Viewer
  4. Registry

1. Using T-SQL

Find the SQL Server error log location setting:

USE master
GO

EXEC sys.xp_readerrorlog 0
	,--Value of error log file you want to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc...
	1
	,--Log file type: 1 or NULL = error log, 2 = SQL Agent log
	N'Logging SQL Server messages in file'
	,--Search string 1: String you want to find
	NULL
	,--Search string 2: String two you want to search for to further refine the results
	NULL
	,--Search from start time
	NULL
	,--Search to end time
	N'asc' --Sort order for results: N'asc' = ascending, N'desc' = descending

The result should be:

2. SQL Configuration Manager

Accessing SQL Server Configuration Manager:

  1. Go to SQL Server Services
  2. Click on the SQL instance on the right (In my case its “SQL2017”)
  3. Right-click, go to Properties
  4. Look for the Startup Parameters tab

One of the “Existing parameters” shows the error log path.

Here are SQL Server logs location on my laptop:

3. Using Event Viewer

Start the Event Viewer (you can use the search box near the Start button).

  1. Click on the Windows Logs > Application > Filter Current Log
  2. Replace <All Event IDs> with EventID 17111 and hit OK.

4. Using registry

Are you serious? Are you going to try to look up the path using the registry?

Yeah, it is possible.

You have three methods above to do this. I do not see a good reason to go the registry route, but in case you must, here it is:

To change or move the error log path, I do this using SQL Server Configuration Manager, change parameter -e.

Restart the SQL Service.

Warning: if the directory does not exist or SQL Server Service does not have enough permissions, SQL Engine will not start.

You will most likely get the “The request failed or the service did not respond in a timely fashion…” error.

To check the SQL Server Agent error log location, go to SQL Server Management Studio > SQL Server Agent > right-click on Properties.

To change the SQL Server Agent error log, just run this:

USE msdb GO

EXEC msdb.dbo.sp_set_sqlagent_properties @errorlog_file = N'<New_Errorlog_Path>\SQLAGENT.OUT' GO

When reviewing the SQL Server, checking the error log is one of the first things I do.

It often has a lot of good info!

Speak with a SQL Expert

In just 30 minutes, we will show you how we can eliminate your SQL Server headaches and provide 
operational peace of mind

Article by
Mark Varnas
Founder | CEO | SQL Veteran
Hey, I'm Mark, one of the guys behind Red9. I make a living performance tuning SQL Servers and making them more stable.

Leave a Comment

Discover More

SQL Server Health Check SQL Server Migrations & Upgrades SQL Server Performance Tuning SQL Server Security SQL Server Tips

Discover what clients are saying about Red9

Red9 has incredible expertise both in SQL migration and performance tuning.

The biggest benefit has been performance gains and tuning associated with migrating to AWS and a newer version of SQL Server with Always On clustering. Red9 was integral to this process. The deep knowledge of MSSQL and combined experience of Red9 have been a huge asset during a difficult migration. Red9 found inefficient indexes and performance bottlenecks that improved latency by over 400%.

Rich Staats 5 stars
Rich Staats
Cloud Engineer
MetalToad

Always willing to go an extra mile

Working with Red9 DBAs has been a pleasure. They are great team players and have an expert knowledge of SQL Server database administration. And are always willing to go the extra mile to get the project done.
5 stars
Evelyn A.
Sr. Database Administrator

Boosts server health and efficiency for enhanced customer satisfaction

Since adding Red9 to the reporting and DataWarehousing team, Red9 has done a good job coming up to speed on our environments and helping ensure we continue to meet our customer's needs. Red9 has taken ownership of our servers ensuring they remain healthy by monitoring and tuning inefficient queries.
5 stars
Andrew F.
Datawarehousing Manager
See more testimonials

Check Red9's SQL Server Services

SQL Server Consulting

Perfect for one-time projects like SQL migrations or upgrades, and short-term fixes such as performance issues or SQL remediation.

Discover More ➜

SQL Server Managed Services

Continuous SQL support, proactive monitoring, and expert DBA help with one predictable monthly fee.

Discover More ➜

Emergency SQL Support

Take the stress out of emergencies with immediate access to a SQL Server Sr. DBA 24x7x365

Discover More ➜
Explore All Services