Skip to content

WHERE ARE SQL SERVER ERROR LOGS STORED?

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!

Published inDatabases

Be First to Comment

Leave a Reply