Summary.Net Archives
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Summary-Talk] script to gzip apache access logs on OSXS?



Apple uses rotatelogs, which doesn't provide for log file compression.

Writing a script to do compression would be a little tricky, since you
need to be careful not to compress the currently active log file, and
all of the ways I can think of to figure that out require some
relatively advanced scripting tricks.

I use logrotate instead of rotatelogs, which does provide for
compression. Logrotate also keeps only the most recent N log files,
instead of all of them, which I like and it has less CPU overhead.
Unfortunately it does not come with OS X and getting it to work with
Apache tends to require a through understanding of Apache configuration
files and avoiding Apple's web site administration tool.

Another approach would be to use httplog instead of rotatelogs,
<http://freshmeat.net/projects/httplog/>. Again some technical knowledge
would be required to glue things together, and httplog hasn't been
updated for some time.

I am rather surprised that there isn't a more polished solution available.

Jason


Mac OS X Server Administrator wrote:
> 
> Our Apache server creates new log files every seven days, and never
> deletes them (which is good), but since we keep all of our log files,
> we'd like it to be gzipping them, too.
> 
> I'm assuming this is something many people are doing, too, but I can't
> find any shell scripts that do this (google, macosxhints, afp548,
> etc.).
> 
> Anyone like to share? (Tiger and Panther Servers, bash and tcsh, 
> respectively).

-- 
Jason@xxxxxxxxxxx
--
Dr. Seuss books . . . can be read and enjoyed on several levels. For
example, 'One Fish Two Fish, Red Fish Blue Fish' can be deconstructed
as a searing indictment of the narrow-minded binary counting system.
   -- Peter van der Linden, Expert C Programming, Deep C Secrets
-------------
Go to <http://summary.net/list.html> to update subscription info.