LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-11-2010, 03:56 AM   #1
linux_bud
LQ Newbie
 
Registered: Nov 2009
Posts: 7

Rep: Reputation: 0
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.
 
Old 01-11-2010, 04:08 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
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?
 
Old 01-11-2010, 04:42 AM   #3
linux_bud
LQ Newbie
 
Registered: Nov 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
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.
 
Old 01-11-2010, 05:13 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
So just add those additional directories to the same line that defines the /var/log/httpd/ directory itself and that shouls be it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate log files rashmeepawar Linux - Server 1 10-21-2009 05:14 AM
eradicate squid log files using cron and logrotate cccc Debian 0 08-21-2007 07:25 AM
how to logrotate auth.log files? clintcan Linux - Security 1 12-10-2005 04:55 PM
logrotate log files - keeping in order when using grep or cat and bash dmellem Linux - Software 6 02-11-2005 01:05 PM
How to add my log files in logrotate Groucho Slackware 2 10-03-2003 08:16 AM


All times are GMT -5. The time now is 03:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration