From: Rich Bowen Date: Sun, 16 Jun 2002 12:17:18 +0000 (+0000) Subject: There's already a program distributed with Apache that does this. X-Git-Tag: 2.0.38~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=719c71e83f128334af6bc0d13857b4b0d32c026a;p=apache There's already a program distributed with Apache that does this. Thanks, Joshua, for pointing this out. Do folks with binary distributions (RPM or whatever) get this program installed somewhere accessible? git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95711 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/vhosts/fd-limits.html.en b/docs/manual/vhosts/fd-limits.html.en index d7ba36af4b..87fbe23e4d 100644 --- a/docs/manual/vhosts/fd-limits.html.en +++ b/docs/manual/vhosts/fd-limits.html.en @@ -97,46 +97,20 @@ href="../mod/mod_log_config.html#formats">Custom Log Formats for more about customizing your log files.)

When you wish to split your log file into its component parts (one -file per virtual host) you can use a program like the following to -accomplish this:

- -
-#!/usr/bin/perl
-# Filename: split_log
-# Usage: split_log multiple_vhost_log
-# Creates one log file per virtual host
-
-use strict;
-my $file = $ARGV[0]; # Name of the log file
-my %fh; # File handles
-
-# Read the log file, one line at a time
-open LOG, $file;
-foreach my $line (<LOG>) {
-    $line =~ s/^(.*?) //;
-
-    # Do we already have a file handle for this vhost?
-    unless ($fh{$1})    {
-        my $handle;
-        open ($handle, '>' , $1 . '_split');
-        $fh{$1} = $handle;
-    }
-
-    # Write out the log entry
-    select ($fh{$1});
-    print $line;
-}
-close LOG;
-
-# Close all the open file handles
-foreach my $h ( keys %fh ) {
-    close $h;
-}
-
+file per virtual host) you can use the program split-logfile to accomplish +this. You'll find this program in the support directory +of the Apache disribution.

+ +

Run this program with the command:

+ +
+split-logfile < /logs/multiple_vhost_log +

This program, when run with the name of your vhost log file, will generate one file for each virtual host that appears in your log file. -Each file will be called hostname_split.

+Each file will be called hostname.log.