I have a script which parses the standard Apache access log file looking for 401 errors and users who have logged in correctly. However, my server uses the combined log format. How can I change this code to parse that log format? Regexp's are still my weak point:
chop;
# Break apart the Apache/NCSA-style access log entry
# regexp assumes there is no "[" in the username.
next unless s/^(\S*) - ([^\[]+) \[*?\] ".*" (\d+) \S*$//;
Thanks in advance.
P.S., an explanation of the regexp would also be appreciated.
[This message has been edited by Bobsie (edited April 14, 1999).]
Code:
while (<> ) { chop;
# Break apart the Apache/NCSA-style access log entry
# regexp assumes there is no "[" in the username.
next unless s/^(\S*) - ([^\[]+) \[*?\] ".*" (\d+) \S*$//;
Thanks in advance.
P.S., an explanation of the regexp would also be appreciated.
[This message has been edited by Bobsie (edited April 14, 1999).]