Posts Tagged ‘where is sql server errorlog stored’

SQL Server – How to change SQL Server ERRORLOG location

08.07.2013 3 comments

By default SQL Server ERRORLOG is stored in "C:Program FilesMicrosoft SQL ServerInstanceFolderMSSQLLog" folder. The ERRORLOG location is configured as a startup parameter for SQL Server Service.


To change the location of ERRORLOG you need to modify the startup parameter -e.

For example, if you need to move logs to C:Logs then replace the startup parameter as below:

Step 1:

Replace "-eC:Program FilesMicrosoft SQL ServerMSSQL11.SQL2012MSSQLLogERRORLOG"

to "-eC:LogsERRORLOG"

Step 2:

Restart SQL Server Service to apply changes. The ERRORLOG will be created to "C:Logs" after SQL Server is restarted.


To change location for SQL Server Agent Logs:

Location for SQL Server Agent Log can be changed using T-SQL or SQL Server Management Studio.

Method 1: To change SQL Server Agent Log location right click on "Error Logs" node and select "Configure"


Provide new location for Log file in "Error Log File" path:


Click on "OK" and restart SQL Server Agent to apply changes.

Method 2: To change log location using T-SQL

To change log location using T-SQL you can use below code:

USE [msdb]


EXEC   msdb.dbo.sp_set_sqlagent_properties

       @errorlog_file = N'C:LogsSQLAGENT.OUT'


Execute this code and restart SQL Server agent to apply changes.

Hope This Helps!