Set New Errorlog File location – SQL Server on Linux

For SQL Server 2017 RTM, the fourth cumulative update was released on 20th February, and it is available for download at the Microsoft Downloads site. It brought a couple of significant improvements like;

Set New Errorlogfile Location

In this blog, I am going to discuss the tip configuring new errorlogfile location on SQL Server on Linux. Let’s follow the below steps to accomplish the relocation of errorlogfile;

  • Verify the current location of SQL Server Error log file on Linux machine
SELECT SERVERPROPERTY('ErrorLogFileName') AS 'Error log file location'

  • Create a newerror folder at “/var/” location and verify it

Syntax: sudo mkdir /var/newerror (It will create the directory newmas)
Syntax: ls -l 

  • Since the created folder is owned by root user & group user, it can’t be accessed by a non-root user. You need to change the ownership of the folder to mssql by running following commands;

Syntax: sudo chown mssql /var/newerror (It changes the user ownership)
Syntax: sudo chgrp mssql /var/newerror (It changes the group user ownership)

  • Fire the below commands to set new errorlog location

Syntax: /opt/mssql/bin/mssql-conf set filelocation.errorlogfile /var/newerror/errorlog

  • Use the following command to STOP the SQL Server service

Syntax: sudo systemctl stop mssql-server

  • START and check the STATUS of SQL Server service

Syntax: sudo systemctl start mssql-server
Syntax: sudo systemctl status mssql-server

  • Verify the new current location of SQL Server Error log file on Linux machine

With the execution of the last step, you have successfully set-up new Errorlogfile location for SQL Server on Linux machine.

Leave a comment

Your email address will not be published. Required fields are marked *