>In the below code, is the backreference $1 useable as I am intending?
#!/usr/bin/perl -w
=Script
Info:=============================================================================
#
# Script : CountCodeRed.pl
# Purpose: to scan apache web server access log files and
# count the number or code red worm attempts
# Created: 08/19/2001
#
# Note:
# This script reads the apache access log in the common log format (CLF
space delimited):
# %h - Remote host
# %l - Remote Log Name
# %u - Remote user
# %t - Time Date stamp in the form of [19/Aug/2001:06:28:45 -0600]
# %\"%r\" - First line of request
# %>s - Status or request
# %b - Bytes sent
=cut
# path to default log file location
$LogFilePath = "/var/log/apache/access.log.0";
$ProcessDate = "";
$DailyHitCount = 0;
$DailyCodeRedHits = 0;
# open log file for reading
open (LOGFILE, $LogFilePath) || die "Can't open log file : $!\n";
while ($line = <LOGFILE>) {
$line =~ /\[(.+)\] /; # get date time value between []
$ThisDateTime = $1; # should look like 19/Aug/2001:06:28:45 -0600
# this works
#($ThisDate, $Junk) = split(/:/, $ThisDateTime);
# this is more elegant? Turn 19/Aug/2001:06:28:45 -0600 into
19/Aug/2001
$ThisDateTime =~ / (^.*?:) /; # is this pattern bad?
$ThisDate = $1; # or does $1 need to be 'reset'?
...
Thanks!
Rob Waggoner
Master Applications Craftsman
WAGGS
Web based Advanced Graphics and Graphing Solutions
http://www.waggs.net
"Applying Old world craftsmanship to New world technologies"
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]