Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem with logrotate, rotating apache initscript as well
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
planet-admin
Apprentice
Apprentice


Joined: 27 Mar 2004
Posts: 213
Location: Boise, ID

PostPosted: Wed Jan 26, 2011 12:55 am    Post subject: Problem with logrotate, rotating apache initscript as well Reply with quote

I have logrotate configured to rotate apache logs, and I'm using ispcp omega. The logs are being rotate properly, however, so is the apache2 init script in /etc/init.d (ending up with a 0 byte apache2 init script). Here is the /etc/logrotate.d/apache2 file, I know there's a syntax error, but I don't know where it's at?

Code:
# Apache2 logrotate snipet for Gentoo Linux
# Contributes by Chuck Short
#
/var/log/apache2/*log {
  missingok
  notifempty
  sharedscripts
        prerotate
                /var/www/ispcp/engine/awstats/awstats_updateall.pl now -awstatsprog=/var/www/localhost/cgi-bin/awstats.pl &> /dev/null
        endscript
        postrotate
                /etc/init.d/apache2 reload > /dev/null 2>&1 || true
        endscript
}



Can anyone help me spot it?

Michael
_________________
Michael S. Moody
Sr. Systems Engineer
Global Systems Consulting
Web: http://www.GlobalSystemsConsulting.com
Back to top
View user's profile Send private message
bodri12
n00b
n00b


Joined: 09 Mar 2011
Posts: 1

PostPosted: Thu Mar 10, 2011 12:00 am    Post subject: Reply with quote

Same problem here, if i have ispcp file in logrotate.d directory too, that have apache reference too. Just see, rewrite your /dev/null too.
Here is a relevant part of ispcp file:
Code:


/var/log/apache2/users/*.log {
  weekly
  missingok
  rotate 52
  compress
  delaycompress
  notifempty
  create 640 root adm
  sharedscripts
  prerotate
    /var/www/ispcp/engine/traffic/ispcp-vrl-traff >/var/log/ispcp/ispcp-vrl-traff.log 2>&1
  endscript
  postrotate
    if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
      /etc/init.d/apache2 reload > /dev/null
    fi
  endscript
}

# Rotation for user traffic prevs
#
/var/log/apache2/backup/*.log.prev {
  size 5M
  missingok
  rotate 5
  compress
  delaycompress
  notifempty
  create 640 root adm
}

# Rotation for apache2, launching general statistics if awstats is installed
#
/var/log/apache2/*.log {
  weekly
  rotate 52
  missingok
  compress
  delaycompress
  notifempty
  create 640 root adm
  sharedscripts
  prerotate
        if [ `cat /etc/ispcp/ispcp.conf | grep -c 'AWSTATS_ACTIVE *= *yes'` = 1 ]; then
      perl /var/www/ispcp/engine/awstats/awstats_updateall.pl now -awstatsprog=/usr/lib/cgi-bin/awstats.pl >/dev/null 2>&1
    fi
  endscript
  postrotate
    if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
                /etc/init.d/apache2 reload > /dev/null
    fi
  endscript
}


If you delete the apache file, then not will rotate runscript, but logrotate wont work well. Anyway reload is an invalid option, use restart instead (not tested yet).

Any logrotate expert can help what's wrong if both script is running ?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum