This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.
You might have noticed in the past that the default behavior in SQL Server on Linux is to keep 128 error logs in the LOG folder.
This differs from the behavior on Windows where we keep only 6 old error log files when you cycle them.
Now you have a mechanism to control how many error log files you want to retain in the LOG folder on Linux. You can install SQL Server 2019 and then use the list option of mssql-conf configuration utility, you will notice that we have a new option named errorlog.numerrorlogs.
If you want to retain 6 error logs in the LOG folder, you will configure it as follows:
You can verify this from the configuration settings file:
If you attempt to configure an invalid value, you will encounter the following error:
Now you will notice that SQL Server cycles only the error logs up to errorlog.6:
After you implement this configuration change, you have to manually get rid of the additional error log files that existed before this configuration change went into effect. In the above example, those would be errorlog.7 onwards that needs to be manually cleaned.
If you need to reset the configuration to the defaults, you can use the following procedure:
If you want to test all this on your dev or QA server where there is no production workload running, you can use a script like this:
Save this snippet as a bash script file and execute it.
Hope this information is useful for you!
Thanks
Suresh Kandoth