Reputation: 4650
How to create new log rotate files for my codeigniter application in LAMP server command line . I want to run this daily process
log files will be like this
application/logs/log-2013-06-12.php
application/logs/log-2013-06-13.php
application/logs/log-2013-06-14.php
application/logs/log-2013-06-15.php
here is my log rotate script if any errors please let me know
/var/www/my-app/application/logs/*.php{
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 640 root password
sharedscripts
dateext
dateformat -web01-%Y-%m-%d-%s
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
Upvotes: 2
Views: 1617
Reputation: 970
The config file you created is fine. Logrotate utility just provides the checking mechanism.
There is /etc/cron.daily/logrotate
file which invokes the logrotate daily.
For testing purpose you can add your cron minutely rule and putting the logrotate's config file under that rule.
Upvotes: 1