LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   logrotate httpd log files (https://www.linuxquestions.org/questions/linux-newbie-8/logrotate-httpd-log-files-781419/)

linux_bud 01-11-2010 03:56 AM

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.

acid_kewpie 01-11-2010 04:08 AM

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?

linux_bud 01-11-2010 04:42 AM

Quote:

Originally Posted by acid_kewpie (Post 3822194)
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?

Yes there is a /etc/logrotate.d/httpd file, but this file handles only *.log files and not directories, i need to logrotate or delete log files that are stored in /var/log/httpd/ ; there are 4 directories under /var/log/httpd/
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.

acid_kewpie 01-11-2010 05:13 AM

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.