September 12, 2019 at 6:38 am
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
September 12, 2019 at 11:16 am
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
September 12, 2019 at 2:57 pm
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