logrotate simple question
It seems that I've done something because there are new log files created, but my log folder looks like this:
> access.log 0
error.log 0
access.log.1 0
error.log.1 0
access.log.2 80,413,564
error.log.2 3,718,266
Obviously, the log is rotating, but the information is all coming along to the new log rather than staying behind in the archive log.
Here is what I have. I added the following to /etc/logrotate.conf:
> # system-specific logs may be configured here
/home/user/public/website.org/log/*.log {
missingok
daily
rotate 30
create 640 root user
}
My /etc/cron.daily/logrotate looks like:
> #!/bin/sh
test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf
Also, I'm not sure what the "test -x" line is about. Can I delete that??
Thanks in advance for any advice.
9 Replies
/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
/etc/init.d/apache2 reload > /dev/null
fi
endscript
}
The 'postrotate' part is the key.
I'm a little afraid to copy and paste this exact code to the bottom of my config. Is there anything in there that I may need to change since I'm referencing the web access logs?
> postrotate
if [ -f "
. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}
" ]; then/etc/init.d/apache2 reload > /dev/null
fi
endscript
Or will this addition do the trick do you think?
> * Reloading web server config apache2
httpd not running, trying to start
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs [fail]
Please help if you have an idea of what I may have done. Thanks!
I've deleted the entire system specific log configuration and it is still not reloading apache2.
I really appreciate your help!
> # If you just change the port or add more ports here, you will likely also
have to change the VirtualHost statement in
/etc/apache2/sites-enabled/000-default
This is also true if you have upgraded from before 2.2.9-3 (i.e. from
Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
README.Debian.gz
NameVirtualHost *:80
Listen 80
# If you add NameVirtualHost *:443 here, you will also have to change the VirtualHost statement in /etc/apache2/sites-available/default-ssl
to
# Server Name Indication for SSL named virtual hosts is currently not supported by MSIE on Windows XP.
Listen 443
Listen 443
The reason I couldn't reload apache was because I forgot that I had not su root. All that was required was sudo!
Like I said. Stupid mistake.