SQLTeam.com | Weblogs | Forums

Finding SQL Server Error Log File Size


How can we find the error log file size in SQL Server. Using T-SQL or any Stored Procedure


The error logs are just simple text files. A typical location would be: C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log. You can find the specific location for your environment by looking in the beginning of the current error log. A few lines in will list the location of the ERRORLOG file. There is nothing special about the file format, you could open it with NOTEPAD. AFAIK, SQL does not have an API to the log file.


Use Powershell to do this work. Do not use SQL Server for file system work as it opens up a security risk.