« perl path on os x | Main | Translating apache log format to dspace »

Regex to pull GET POST commands from apache logs

The regex: perl -p -i -e 's/^.*\s\"(GET|POST)(.*)\"\s.*\".*\".*\"$/\1\2/' Will extract:
GET /bitstream/34171/1/sp06pa01.pdf HTTP/1.1

from
99.239.52.187 - - [21/Sep/2008:09:38:24 -0500] "GET /bitstream/34171/1/sp06pa01.pdf HTTP/1.1" 200 16368 "http://www.google.ca/search?hl=en&q=positive+effects+on+canada+from+immigration&start=10&sa=N" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"

TrackBack

TrackBack URL for this entry:
http://blog.lib.umn.edu/cgi-bin/mt-tb.cgi/84205

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)