sub split_logfile { # As adapted from the split-logile perl script from the Apache group my($vhost); my($log_line); my(%is_open); open(LOG, "<$access_log") or die("Cannot open $access_log for processing: $!"); while($log_line = ) { ($vhost) = split(/\s/, $log_line); $vhost = lc($vhost); if (! $is_open{$vhost}) { open $vhost, ">>$work_dir/${vhost}.log" or die ("Cannot open ${vhost}.log: $!"); $is_open{$vhost} = 1; } $log_line =~ s/^\S*\s+//; printf($vhost "%s", $log_line); } print("DONE\n"); }