Where Is The SQL Server ErrorLog File?
October 19, 2010 6 Comments
I seldom lose things; I just cannot find them as quickly as I’d like. This is true for keys, tools, and yes even ErrorLog files on SQL Server.
On the servers that I configure, I have a standard way of doing things. I set them up using some industry best practices and some standards that I’ve developed over the years. On those servers, I can find the ErrorLog file quickly since it is in a predictable place for me.
Using T-SQL To Find The ErrorLog File
In my consulting practice, I regularly work with SQL Servers that I did not configure. For those servers, I must discover where things are. One technique that I use is to ask SQL Server itself where things are. For example, the following T-SQL query will return the location of the ErrorLog file.
It will return something like the following:
E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG
This technique is particularly useful when I’m examining the ErrorLog in a PowerShell script. I blogged about that The Power Of RegEx in PowerShell.