4

I have six error logs plus the current. They are taking up 10G of disk space on my hard drive on my VPS server. Thats about 25% of the server space. The largest file is 6G and growing.

How can I remove the error logs as I don't need them and reduce the size in which the archive files grow to before recycling.

Thanks,

  • I mean the ones that appear in "Management -> SQL Server Logs" node. The ones that are stored in the C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log folder. – MiscellaneousUser Nov 16 at 17:45
7

Thats about 25% of the server space.

First and foremost, you really need to increase the size of your drive or move the error logs to a different drive. ~40GB for a C:\ drive might've been an okay default years ago, but you can quickly burn through that with misc files from applications - as you're seeing.

You can easily configure this via SQL Server Configuration Manager:

enter image description here

by modifying the directory for the -e parameter, which controls the error log destination.


How can I remove the archive logs as I don't need them and reduce the size in which the archive files grow to before recycling.

You can of course just delete the files manually, but it sounds like you really want to reduce the number of logs used and/or reduce their size.

The steps contained in the above link detail how to do this in SQL Server Management Studio:

  1. In Object Explorer, expand the instance of SQL Server, expand Management, right-click SQL Server Logs, and then click Configure.

  2. In the Configure SQL Server Error Logs dialog box, choose from the following options.

    a. Log files count

    Limit the number of the error log files before they are recycled

    Check to limit the number of error logs created before they are recycled. A new error log is created each time an instance of SQL Server is started. SQL Server retains backups of the previous six logs, unless you check this option, and specify a different maximum number of error log files below.

    Maximum number of error log files

    Specify the maximum number of archived error log files created before they are recycled. The default is 6, not including the current one. This value determines the number of previous backup logs that SQL Server retains before recycling them.

    b. Log file size

    Maximum size for error log file in KB

    You can set the size amount of each file in KB. If you leave it at 0 the log size is unlimited.

enter image description here

  • 40G is the VPS hosting package. The second yellow box, when i go into it, the min size is... drumroll.... 6 which is what its currently at :(. I'd rather not delete the files manually as I don't know which files to delete so was looking for a solution to handle it and tidy things up nicely.. – MiscellaneousUser Nov 16 at 18:13
  • 2
    Then reduce the Maximum size for error log file in KB to your desired total error log retention divided by 6. Then the error log will roll over each time it gets to that size, and you'll have at most 6 of them. – David Browne - Microsoft Nov 16 at 18:21
  • 2
    ...and I always recommend to go through the errorlog and see what message/error is triggered over and over again making the errorlog that huge. Ideally you only want startup info, DBCC CHECKDB messages and successful backup messages (unless you turned those off). Now you can use the errorlog as a part of health check/diag. – Tibor Karaszi Nov 17 at 13:48
  • That log file size setting doesn't appear in my config screen :(. Using 2014 Express. – MiscellaneousUser Nov 18 at 20:25
  • Try using a newer SSMS version, and if that does not work try these steps – LowlyDBA Nov 18 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.