Set the Maximum Size of the SQL Server Error Logs
In SQL Server 2012 and later versions, you can use xp_instance_regwrite to set the maximum size of individual error logs. Please make this setting available via SMO, instead of having to use xp_instance_regwrite.
Documentation for this feature can be found here: https://support.microsoft.com/en-us/help/2199578/how-to-manage-the-sql-server-error-log
I’ll get this going for 17.7
Aaron Nelson commented
For those who are interested, here is the code that you would currently have to run:
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE',
N'ErrorLogSizeInKb', REG_DWORD, 5120;