Recycle SQL Agent Error Logs

  • hi all

    I want to keep 1 month worth of SQL agent Error logs and plan to cycle every week  by running : EXEC dbo.sp_cycle_agent_errorlog ( using SQL JOB)

    How do I do this ?

    Thanks All

     

  • Create a job with a job step in msdb database that executes the command: Exec dbo.sp_cycle_agent_errorlog

    And then schedule it to run once a week.

    Sue

  • By default, the agent maintains 9 logs. Each time the service starts, it creates a new log and discards the oldest one.

    If you recycle manually once a week, you should have nine weeks, but any service restart could change this, so you could potentially have less than a month of logs at any time. You can also set to remove history older than xx weeks in the Agent Properties.

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply