LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 11-06-2012, 05:27 AM   #1
alireza.kayvan
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Rep: Reputation: Disabled
logrotate doesnt work properly for virtualhosts


I want to rotate virtualhost logs when it excceded 200M . I created a /etc/logroate.d/vhosts and execute command : logrotate -v -f /etc/logrotate.d/vhosts . it seams every time i run the command all log files rotate. could anyone tell me where the problem is ?



/etc/logroate.d/vhosts :

/var/www/[0-9A-Za-z]*/logs/access_log {
size 200M
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
}

/var/www/[0-9A-Za-z]*/logs/error_log {
size 200M
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
}
This is one of my log directories listing:
-rw-r----- 1 root adm 14K 2012-11-06 14:23 access_log
-rw-r----- 1 root adm 8.4K 2012-11-06 13:45 access_log.1
-rw-r----- 1 root adm 531 2012-11-06 13:36 access_log.2.gz
-rw------- 1 www-data www-data 2.6M 2012-11-06 13:24 access_log.3.gz
-rw-r----- 1 root adm 1.9K 2012-11-06 14:20 error_log
-rw-r----- 1 root adm 1.3K 2012-11-06 13:45 error_log.1
-rw-r----- 1 root adm 184 2012-11-06 13:30 error_log.2.gz
-rw------- 1 www-data www-data 491K 2012-11-06 13:21 error_log.3.gz
 
Old 11-07-2012, 02:04 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,933
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
From the man page...

Code:
-f, --force
              Tells  logrotate  to force the rotation, even if it doesn’t think this is necessary.  Sometimes this is useful after adding new entries to a
              logrotate config file, or if old log files have been removed by hand, as the new files will be created, and logging will continue correctly.
So your original question

Quote:
it seams every time i run the command all log files rotate. could anyone tell me where the problem is ?
There is no problem...the command is running as it should
 
Old 11-18-2012, 12:17 AM   #3
alireza.kayvan
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you , yes ,its running correctly , I checked it the days after. it was ok

Last edited by alireza.kayvan; 11-18-2012 at 02:49 AM.
 
  


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
[SOLVED] mt command doesnt work properly in RHEL 5.3 sree.m Linux - Server 4 03-30-2012 06:38 AM
[SOLVED] The shutdown-command doesnt work properly Suppen Linux - General 4 01-14-2010 08:52 AM
logrotate doesnt not rotate properly Niceman2005 Linux - Software 2 06-22-2009 04:26 AM
KDE and mousewheel. Doesnt work properly kc0eks Linux - Hardware 1 04-03-2007 03:46 PM
Transparencies doesnt work properly Slackware 10.1 + fluxbox Nah Slackware 5 03-06-2005 07:19 PM


All times are GMT -5. The time now is 11:51 PM.

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