HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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