logrotate httpd log files
Hi,
I need to logrotate logs in directories in /var/log/httpd/. There are 4 directories in /var/log/httpd/... these directories are /var/log/httpd/access/ /var/log/httpd/debug/ /var/log/httpd/error/ /var/log/httpd/required/ Each of the access, required, error and debug directories have around 20 to 30 access log files of different locations for example:mumbai-access.log, pune-access.log etc..same is the case for 'error' dir 'required' dir and 'debug' dir in /var/log/httpd/ I need to clean up the logfiles in all the 4 directories access, error, debug and required... I have made a custom logrotate file as follows: ------------------------------------------------------------------------- # vi /etc/logrotate.d/httpd-logs /var/log/httpd/access/*.monitor.com-access_log { weekly missingok nocreate postrotate find /var/log/httpd/access -name '*.monitor.com-access_log' -type f -mtime +7 -print | xargs /bin/rm -rf endscript } /var/log/httpd/error/*.monitor.com-error_log { weekly missingok nocreate postrotate find /var/log/httpd/error -name '*.monitor.com-error_log' -type f -mtime +7 -print | xargs /bin/rm -rf endscript } /var/log/httpd/request/*.monitor.com-ssl_request_log { weekly missingok nocreate postrotate find /var/log/httpd/request -name '*.monitor.com-ssl_request_log' -type f -mtime +7 -print | xargs /bin/rm -rf endscript } /var/log/httpd/debug/*.monitor.com-rw_log { weekly notifempty missingok compress } --------------------------------------------------------------------------- Is the above config correct? Am I missing something? Will this logrotate the files in /var/log/httpd/access, /var/log/httpd/error, /var/log/httpd/required and /var/log/httpd/error ? do i need to include following line in postrotate " /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true" ? Please help. |
why are you including the postrotate to delete the files??
do you not have an existing logrotate.d/httpd to handle these? Would you not just want to rotate everything in each directory? |
Quote:
they are as follows: /var/log/httpd/access/, /var/log/httpd/error/, /var/log/httpd/required/ /var/log/htpd/debug/ Each of the above 4 dirs hold around 20 files *.access.log in /var/log/httpd/access/ dir *.error.log in /var/log/httpd/error/ dir *.debug.log in /var/log/httpd/error/ dir *.required.log in /var/log/httpd/error/ dir I need to logrotate or delete these files. |
So just add those additional directories to the same line that defines the /var/log/httpd/ directory itself and that shouls be it.
|
All times are GMT -5. The time now is 06:59 PM. |