From 51f1e834b8f73720005ee5bbb53a66552df115ff Mon Sep 17 00:00:00 2001 From: Richard Bowen Date: Sun, 16 Jun 2002 12:17:18 +0000 Subject: [PATCH] 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 --- docs/manual/vhosts/fd-limits.html.en | 48 +++++++--------------------- 1 file changed, 11 insertions(+), 37 deletions(-) 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.

-- 2.40.0