Hi, I would like to know if there is any industry standard or Microsoft recommended period for retention of SQL Server Event/Error logs. Any information in this regard would be appreciated. Thanks! Apologies for not specifying correctly earlier. Yes Ken, the question is about error/event logs and not transaction logs. Appreciate your help.
There are no industry standards for this behaviour as "it depends". What does your business require you be able to explain / go back to? What do you want to be able to figure out? How much disk space have you got? These files can grow large... To cycle the error log - ie create a new log and move the old ones down the list (from errorlog -> errorlog.1 -> errorlog.2 etc), look at running [`sp_cycle_errorlog`]. On my production and DR clusters, this is set up as a scheduled task to run every weekend; some people I know have this set up to run every day at midnight. Similarly, use [`sp_cycle_agent_errorlog`] to do the SQL Agent logs. In order to manage the number of error log files, you need to get down & dirty with the registry. Or use T-SQL to do it for you - see, for example, our own @Tim Radney's blog post