I have an openSUSE server running 12.1 with Apache which is hosting a few websites using virtual hosting. I have enabled logrotate and my settings look like this:
My web logs are rotating around 11pm and I need them to rotate at midnight so I can take the logs and inject them into WebTrends. I googled around trying to find a solution to this problem because now I want my logs to rotate on a daily basis with a date/time stamp on the older logs and want to keep 35 days worth of logs before they start falling off the system, get deleted.
If I changed the logrotate to the following the logs should rotate daily but how can I set the midnight time to rotate the logs?
Is there a better or more efficient way to rotate these logs on a daily basis at midnight? I tried adding this to one of my virtual host conf files - CustomLog “|/usr/sbin/rotatelogs /opt/www/awesome-project/log/access.%Y-%m-%d.log 86400” combined but the logs still didn’t rotate.
Wow! A month later and no help. For anyone else looking for a possible answer this is what I did. I moved the logrotate out of the /etc/cron.daily directory to /root and created a cron job - 0 0 * * * root /root/logrotate
> Wow! A month later and no help. For anyone else looking for a possible
> answer this is what I did. I moved the logrotate out of the
> /etc/cron.daily directory to /root and created a cron job - 0 0 * * *
> root /root/logrotate
I do not read all posts, and yours I did not notice at the time. I have
seen it now, as it has gone up in the queue, and what you did is precisely
what I would have suggested, if your machine is up continuously.
There is another method, which is adjusting “/etc/sysconfig/cron”.
[CRON]
Type: string
Default: “”
Type: time (eg: 14:00)
Default: nothing
At which time cron.daily should start. Default is 15 minutes after booting
the system. Due to the fact that cron script runs only every 15 minutes,
it will only run on xx:00, xx:15, xx:30, xx:45, not at the accurate time
you set.
DAILY_TIME=“23:55”
[CRON]
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)