1753481 Members
4564 Online
108794 Solutions
New Discussion

logs rotation at 22:15

 
user_smanas
Occasional Contributor

logs rotation at 22:15

how can I rotate logs daily at 22:15

 

following is my syslog-ng configuration in logrotate:

 

/var/log/vta.log {
    dateext
    rotate 365
    daily
    missingok
    copytruncate
    create 640 root root
    postrotate
    /etc/init.d/syslog reload
    endscript
}

 

Please help

 

Regards

Maaz

1 REPLY 1
Matti_Kurkela
Honored Contributor

Re: logs rotation at 22:15

If you want to rotate all daily-rotatable logs at 22:15, you should modify the time when your daily logrotate task runs.

Typically, logrotate is started by a script in /etc/cron.daily (or one of the other /etc/cron.* directories). If that is the case, then /etc/crontab (or in some cases, /etc/cron.d/anacron) determines the time when the tasks in /etc/cron.daily and similar directories are run. When you find the right entry, modify it to make it run at the time you want.

 

If you want to rotate only a specific set of logfiles at 22:15 daily, make a separate logrotate configuration file in some custom location (e.g. /etc/my-logrotate.conf) for those logfiles, and set up a cron job to start logrotate with that configuration file on 22:15 daily.

 

The cron job might look like this:

15 22 * * * /usr/sbin/logrotate /etc/my-logrotate.conf

 

MK