Writings Photos Code Contact Resume
Extracting values from your apache log.

You are here

Submitted by msameer on Sun, 25/12/2005 - 10:06am

Don't try to understand this, It'll lead to brain cancer ;-)

Just use it to extract things from your apache web server access log.

perl -n -e '/(.[^ ]*) -(.[^-]*)- \[(\d*)\/(\w*)\/(\d*):(\d*):(\d*):(\d*) (.[^\]]*)\] "(\w*) (.[^ ]*) .[^"]*" (\d*) (.[^ ]*) "(.[^"]*)" "(.[^"]*)"/; print "$1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 \n"' access.log

This is the base to build my apache log to mysql atabase script.


Submitted by راميٍ (not verified) on Mon, 26/12/2005 - 6:22am

Ya ostaz ana me7tag khabir perl zayyak. I'm learning it for my 'Bioinformatics,' but it's not easy to teach a informatics to a biologist.

From what I have learnt now, I guess you're trying to match 15 regular expressions and print them :P shoft ana nabih ezzay :}
Bass ana men sa3et ma katabtaha fel shell, wel beta3 ze3el awi we masa2alsh feyya.

Submitted by msameer on Mon, 26/12/2005 - 8:45am

Works fine here, It shouldn't take much time as it's processing line by line.

Submitted by `ahmed (not verified) on Wed, 10/05/2006 - 3:29pm

you're ignoring the HTTP protocol version ;)

Add new comment

Subscribe to /  digg  bookmark