Skip to content

Instantly share code, notes, and snippets.

@tuxnker
Created February 27, 2016 09:58
Show Gist options
  • Save tuxnker/f3a91b782eec9c78ff83 to your computer and use it in GitHub Desktop.
Save tuxnker/f3a91b782eec9c78ff83 to your computer and use it in GitHub Desktop.
function max(arr, big) {
big = 0;
for (i in cat) {
if (cat[i] > big) { big=cat[i]; }
}
return big
}
NF > 0 {
cat[$1]++;
}
END {
maxm = max(cat);
for (i in cat) {
scaled = 60 * cat[i] / maxm;
printf "%-25.25s [%8d]:", i, cat[i]
for (i=0; i<scaled; i++) {
printf "#";
}
printf "\n";
}
}
@tuxnker
Copy link
Author

tuxnker commented Feb 27, 2016

Count IP hits from webserver logs
usage
cat /var/log/access.log|awk -f /home/raldea/dos.awk | sort -nrk3|less

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment