Skip to content

Instantly share code, notes, and snippets.

@da3mon
Created October 9, 2008 15:52
Show Gist options
  • Save da3mon/15802 to your computer and use it in GitHub Desktop.
Save da3mon/15802 to your computer and use it in GitHub Desktop.
#usage: zsr _m_ _n_ : sowest _n_ requests from gzipped log file _m_
function zsr () {
zgrep ' (0 reqs/sec) ' $1|
awk '{ print $8 " - Mongrel:" $13", " $14 " DB:" $17", "$18 " " $22 }' |
sort -nr|head -n $2;
}
#usage: sr _m_ _n_ : sowest _n_ requests from log file _m_
function sr () {
grep ' (0 reqs/sec) ' $1|
awk '{ print $8 " - Mongrel:" $13", " $14 " DB:" $17", "$18 " " $22 }' |
sort -nr|head -n $2;
}
#histogram of most frequently hit urls
zgrep ': Completed ' production-combined.log-20081008.gz|awk '{ print $NF }'|sort|uniq -ci|sort -nr|head -n 100
#url access times, slowest first
zgrep ' Completed.*http://site/route' production-combined.log-20081008.gz|awk '{ print $8 " erb:" $13 " db:" $17 " url:" $NF }'|sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment