|Perl Monk, Perl Meditation|
Parsing Apache logs with Regexby TheGorf (Novice)
|on Dec 31, 2008 at 19:54 UTC||Need Help??|
TheGorf has asked for the
wisdom of the Perl Monks concerning the following question:
For a project here at work I have to comb through a lot of logfiles trying to detect some issues. I'm trying to scan through the Apache logfiles and split them into logical pieces line by line so I can mangle the data as needed.
So lets say I have this actual entry in my logfile:
184.108.40.206 - - [14/Jan/2008:02:25:54 -0800] "GET /display.cgi?2643943|3334115 HTTP/1.1" 200 55 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/523.10.6 (KHTML, like Gecko)" "220.127.116.11"
I'm attempting to break the line up with this regex:
For some reason the code tag formats that funny. Anyway... that pattern never matches to the logfile entry. I'm not hugely strong on Regex so I am hoping I am just overlooking something obvious.