Home / Databases / 1 min read • 2015-08-13

WHERE ARE SQL SERVER ERROR LOGS STORED?

🚀
Carlos Rodrigues
Full Stack Engineer

Lately I had to provide the location of our SQL server error logs to an infra team, so they could be copied somewhere else.

Raising a ticket and asking the DBAs is always an option, but as usual will introduce some latency.

No worries, there’s a command we can run to get hold of the error logs location:

exec sp_readerrorlog

This will return a set of text rows, one of which says something like:

2015-10-07 01:52:07.770 Server Logging SQL Server messages in file ‘ERROR LOG PATH‘.

The problem is that I didn’t have any other rights on this SQL server, other than select permission, so it was impossible to execute this procedure.

Fear not, dear friends, there’s another way, using a simple select:

SELECT SERVERPROPERTY('ErrorLogFileName');

and this will return the exact error log path!

Cheers!

Comments (0)

No comments yet. Be the first to share your thoughts!

Leave a Comment