| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| # awk 'BEGIN {min=9999999} $NF > max {max=$NF; maxline=$0}; $NF < min {min=$NF; minline=$0} END {print max, maxline "\n" min, minline}' access.log 3190709 192.168.1.200 - - [07/Jul/2008:15:53:38 +0000] "GET /700.xml HTTP/1.0" 200 24634 3190709 193 192.168.1.200 - - [06/Jul/2008:21:25:40 +0000] "GET /audio/vm/ Numbers%20(0).wav HTTP/1.0" 304 - 193 # cat tt.awk function cvttime(t, a) { split(t,a,"[/:]") match("JanFebMarAprMayJunJulAugSepOctNovDec",a[2]) a[2] = sprintf("%02d",(RSTART+2)/3) return( mktime(a[3]" "a[2]" "a[1]" "a[4]" "a[5]" "a[6]) ) } BEGIN { now=systime(); tgt=300; mintime=99999999 } { then=cvttime(gensub(/.*\[(.*)\].*/,"\\1","")) } { if ((now - then) < tgt) { $NF > maxtime {maxtime=$NF; maxline=$0}; $NF < mintime {mintime=$NF; minline=$0}; hits++; sumtime+=$NF; th=then } else {exit} } END { print "sumtime="sumtime, "hits="hits, "maxtime="maxtime, "mintime="mintime "\n" maxline "\n" minline "\n" } # tac access.log | awk -f tt.awk awk: tt.awk:9: { if ((now - then) < tgt) { $NF > maxtime {maxtime=$NF; maxline=$0}; $NF < mintime {mintime=$NF; minline=$0}; hits++; sumtime+= $NF; th=then } awk: tt.awk:9: ^ syntax error awk: tt.awk:9: { if ((now - then) < tgt) { $NF > maxtime {maxtime=$NF; maxline=$0}; $NF < mintime {mintime=$NF; minline=$0}; hits++; sumtime+= $NF; th=then } awk: tt.awk: 9: ^ syntax error |
|
#2
| |||
| |||
| On Jul 7, 3:47*pm, dnlc...@gmail.com wrote: > # awk 'BEGIN {min=9999999} $NF > max {max=$NF; maxline=$0}; $NF < min > {min=$NF; minline=$0} END {print max, maxline "\n" min, minline}' > access.log > 3190709 192.168.1.200 - - [07/Jul/2008:15:53:38 +0000] "GET /700.xml > HTTP/1.0" 200 24634 3190709 > 193 192.168.1.200 - - [06/Jul/2008:21:25:40 +0000] "GET /audio/vm/ > Numbers%20(0).wav HTTP/1.0" 304 - 193 > > # cat tt.awk > function cvttime(t, * * a) { > * * * * split(t,a,"[/:]") > * * * * match("JanFebMarAprMayJunJulAugSepOctNovDec",a[2]) > * * * * a[2] = sprintf("%02d",(RSTART+2)/3) > * * * * return( mktime(a[3]" "a[2]" "a[1]" "a[4]" "a[5]" "a[6]) )} > > BEGIN { now=systime(); tgt=300; mintime=99999999 } > { then=cvttime(gensub(/.*\[(.*)\].*/,"\\1","")) } > { if ((now - then) < tgt) { $NF > maxtime {maxtime=$NF; maxline=$0}; > $NF < mintime {mintime=$NF; minline=$0}; hits++; sumtime+=$NF; > th=then } > * else {exit} } > END { print "sumtime="sumtime, "hits="hits, "maxtime="maxtime, > "mintime="mintime "\n" maxline "\n" minline "\n" } > > # tac access.log | awk -f tt.awk > awk: tt.awk:9: { if ((now - then) < tgt) { $NF > maxtime {maxtime=$NF; > maxline=$0}; $NF < mintime {mintime=$NF; minline=$0}; hits++; sumtime+= > $NF; th=then } > awk: tt.awk:9: * * * * * * * * * * * * * * * * * * * * * ^ syntax > error > awk: tt.awk:9: { if ((now - then) < tgt) { $NF > maxtime {maxtime=$NF; > maxline=$0}; $NF < mintime {mintime=$NF; minline=$0}; hits++; sumtime+= > $NF; th=then } > awk: tt.awk: > 9: > ^ syntax error I think there was a problem of posting yesterday, so this message appears two times. Can someone delete one? sorry for that. |
|
#3
| |||
| |||
| On Tue, 08 Jul 2008 10:02:36 -0700, dnlchen wrote: >> 9: >> ^ syntax error > > I think there was a problem of posting yesterday, so this message > appears two times. Can someone delete one? sorry for that. hem, are you by any bad luck chance posting from GooGroobs and believed the propaganda they use as a supposedly "help caption" "Create mailing lists and discussion groups" This is not a mailing list, this is Usenet groups, this is not a "discussion group" like an IRC (or chat) parlour, this is an unmoderated Usenet group and what you post is here to stay (at least as long as the GG and the govs looneys won't have it as stone cold dead as the prick of a spammer). -- stop this right now, there's no fish in here. - Ice Rink Manager |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.