LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   after setting up logrotate for apache, logging stops (https://www.linuxquestions.org/questions/linux-general-1/after-setting-up-logrotate-for-apache-logging-stops-601166/)

apachenew 11-20-2007 11:16 AM

after setting up logrotate for apache, logging stops
 
Hello,
Our Redhat ES 4 Linux box's apache 2.2.6 was compiled so the apache logs weren't being rotated automatically. So I've created a logrotate by creating a file inside of /etc/logrotate.d/ directory as:

/etc/logrotate.d/apache

/wwwroot/logs/access_log /wwwroot/logs/error_log /wwwroot/logs/ssl_request_log {
weekly
compress
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

It rotates now but as it's rotated, the apache logging stops and doesn't log anymore until I manually restart apache.
Is there something wrong with the file I created for rotation?
The access_log, error_log, and ssl_request_log are all 0 at this point until I restart apache:

-rw-r--r-- 1 root root 0 Nov 18 04:02 access_log
-rw-r--r-- 1 root root 3220179 Nov 18 04:02 access_log.1.gz
-rw-r--r-- 1 root root 240854649 Nov 11 04:05 access_log.2.gz
-rw-r--r-- 1 root root 0 Nov 18 04:02 error_log
-rw-r--r-- 1 root root 1327595 Nov 18 04:02 error_log.1.gz
-rw-r--r-- 1 root root 61193640 Nov 11 04:06 error_log.2.gz
-rw-r--r-- 1 root root 5 Nov 15 18:50 httpd.pid
-rw-r--r-- 1 root root 0 Nov 18 04:02 ssl_request_log
-rw-r--r-- 1 root root 3057768 Nov 18 04:02 ssl_request_log.1.gz
-rw-r--r-- 1 root root 211737132 Nov 11 04:10 ssl_request_log.2.gz

Any suggestions?

Tinkster 11-20-2007 11:48 AM

Add a postrotate entry for apache? Apache is actually still
logging, just to an unlinked file. You'll probably notice that
the disk-space is slowly decreasing ;}

I don't know the init-structure of RH, but on debian the entry
for logrotate looks something like:
Code:

/var/log/apache/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
          if [ -f /var/run/apache.pid ]; then \
            if [ -x /usr/sbin/invoke-rc.d ]; then \
                invoke-rc.d apache reload > /dev/null; \
            else \
                /etc/init.d/apache reload > /dev/null; \
            fi; \
          fi;
        endscript
}

You get the idea - and restarting syslog for apache shouldn't
be necessary.



Cheers,
Tink

apachenew 11-26-2007 10:59 AM

Thanks, it must've been the postrotate entry.


All times are GMT -5. The time now is 12:20 AM.