• almirfiorio - Thursday, March 1, 2018 3:15 PM

    Sue_H - Thursday, March 1, 2018 2:32 PM

    almirfiorio - Thursday, March 1, 2018 2:27 PM

    Michael L John - Thursday, March 1, 2018 1:51 PM

    Do you want 10 DAYS, or 10 log files? 
    If you are recycling the logs on a nightly basis, then going into settings is the way to do it as Sue_H suggested. 
    If you are not recycling the logs, then you may need to implement that as well as what Sue said.

    im want only 10 days of log

    So as Michael and I are both getting at is you can:
    Daily you can execute sp_cycle_errorlog. You can create a job to do this at midnight (or whatever time) every day so the log is cycled every day.
    And then set max files to 10.

    Sue

    Great

    you have this jobs? 

    im want to keep 10 days of all logs (swl server log)

    this job keep only error logs ?

    Thanks
    Almir

    The job would cycle the error logs which means just create a new one. And then when you right click on the SQL Server Logs folder select Configure and set it to 10, it will automatically delete the logs and will just keep 10 of them. So if you cycle the log every day, that would leave a log for every day and you would have 10 logs. So 10 days.
    To  create the job, just create a new job and it's just one t-sql step of:
    sp_cycle_errorlog

    Sue