5.10 Rotating the Log Files

 <  Day Day Up  >  

Squid writes to a number of log files unless you disable them in squid.conf . You must periodically rotate the log files to prevent them from consuming too much disk space. Squid places a lot of importance on log files and exits with an error message when it can't write to them. To keep disk space consumption under control, use the following command in a cron job:

 % squid -k rotate 

For example, this crontab entry rotates the logs every 24 hours, at 4 A.M.:

 0 4 * * * /usr/local/squid/sbin/squid -k rotate 

This command does two things. First, it closes the currently open log files. Then, it renames the cache.log , store.log , and access.log files by appending a numeric extension. For example, cache.log becomes cache.log.0 , cache.log.0 becomes cache.log.1 , and so on, up to the value of the logfile_rotate option.

Squid keeps only the last logfile_rotate versions of each log file. The older versions are simply removed during the renaming process. If you want to keep more copies, you need to increase the logfile_rotate limit or write some custom scripts that move the log files to a different location.

See Section 13.7 for additional information about rotating log files.

 <  Day Day Up  >  


Squid
Squid: The Definitive Guide
ISBN: 0596001622
EAN: 2147483647
Year: 2004
Pages: 401
Authors: Duane Wessels

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net