You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bill Parker <do...@netnevada.net> on 2003/08/06 04:00:23 UTC

[users@httpd] log rotate example

Does some kind person have a logrotate example they could post to rotate 
the logs in
apache 2.0.47 (path is /usr/local/apache2/logs) that they could post 
here.  I have this
installed on a RH 8.0 box and would like to see how someone does this on a 
daily basis

Apache is just a stock compile + PHP (2.0.47), no SSL stuff

-Bill



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] log rotate example

Posted by Joseph A Nagy Jr <jo...@charter.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 05 August 2003 21:00, Bill Parker wrote this in an attempt to 
be witty and informative:
> Does some kind person have a logrotate example they could post to
> rotate the logs in
> apache 2.0.47 (path is /usr/local/apache2/logs) that they could post
> here.  I have this
> installed on a RH 8.0 box and would like to see how someone does this
> on a daily basis
>
> Apache is just a stock compile + PHP (2.0.47), no SSL stuff
>
> -Bill

#logrotate script for Apache log files
compress

/linux/logs/*.log {
    rotate 31
    daily
    size=100k
    sharedscripts
    extension old
    postrotate
                              /usr/sbin/httpd -k graceful
                              /bin/mv -f *.gz /linux/logs/compressed
    endscript
}

/linux/logs/*_log {
    rotate 31
    daily
    size=100k
    sharedscripts
    extension old
    postrotate
                              /usr/sbin/httpd -k graceful
                              /bin/mv -f  *.gz /linux/logs/compressed
    endscript
}

I have a nice little crontab job that takes care of this on a daily 
basis at around noon. (:
- -- 
Wielder of the mighty +1 LARTsaber of Unsubscribe Instructions At End of
Message, the +3 Clue-by-Four of No Attachments to a Mailing List, and
the -4 Shield of No Spell Checker. http://jan-jr-ent.homelinux.org
http://joseph-a-nagy-jr.homelinux.org http://mc-luug.homelinux.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/MTQbnjt9jEvKYeARAis3AJ9Vf/cl8zXX5idxMFC1xgnNLkyoIwCfWtaw
wkE96xcUQ/CE8D+E1jEmn1o=
=CKYK
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] log rotate example

Posted by David Tonhofer <el...@m-plify.net>.
Here you go. Note that all the HUPing is actually overkill, you want
to that only once, but so far it does not have any ill effects. Your
path is also different. Also, I have one error log, several site logs
and one ssl log.

File /etc/logrotate.d/httpd contains>


--------------------------------------
/var/log/httpd/error_log {
    daily
    rotate 65
    nomissingok
    ifempty
    olddir /var/log/httpd/error_dir
    create 640 root sysop
    mail sysop@m-plify.com
    mailfirst
    compress
    delaycompress
    postrotate
        /usr/local/apache2/bin/apachectl graceful
        # there will be some activity on the saved log, so don't compress
        # if you want to compress, sleep for 600 or use delaycompress
        # echo "Rotated httpd error_log"
    endscript
}

/var/log/httpd/access_site1_log {
    daily
    rotate 65
    nomissingok
    ifempty
    olddir /var/log/httpd/access_site1_dir
    create 640 root sysop
    compress
    delaycompress
    postrotate
        /usr/local/apache2/bin/apachectl graceful
        # there will be some activity on the saved log, so don't compress 
immediately
        # if you want to compress, sleep for 600 or use delaycompress
        # echo "Rotated httpd access_site1_log"
    endscript
}

.....other sites

/var/log/httpd/ssl_log {
    daily
    rotate 65
    nomissingok
    ifempty
    olddir /var/log/httpd/ssl_dir
    create 640 root sysop
    compress
    delaycompress
    postrotate
        /usr/local/apache2/bin/apachectl graceful
        # there will be some activity on the saved log, so don't compress 
immediately
        # if you want to compress, sleep for 600 or use delaycompress
        # echo "Rotated httpd ssl_log"
    endscript
}
--------------------------------------

--On Tuesday, August 05, 2003 7:00 PM -0700 Bill Parker 
<do...@netnevada.net> wrote:

> Does some kind person have a logrotate example they could post to rotate
> the logs in apache 2.0.47 (path is /usr/local/apache2/logs) that they
> could post here.  I have this installed on a RH 8.0 box and would like to
> see how someone does this on a daily basis
>
> Apache is just a stock compile + PHP (2.0.47), no SSL stuff
>
> -Bill
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org