Sql-server – How to rotate trace logs in SQL Server

logsql servertrace-flags

We are using 4032 & 3605 trace flags in SQL Server 2012 to get the expected log output.

Now, we would like to rotate the log files on daily basis to archive it in Amazon Glacier storage facility.

Any pointers on log rotation would be appreciated,

Best Answer

To rotate the logs you just need to execute

EXEC master.sys.sp_cycle_errorlog;

You can schedule the execution daily or as often as it makes sense in your scenario with a SQL Server agent job.