Skip to content

Instantly share code, notes, and snippets.

@rambabusaravanan
Created April 30, 2017 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rambabusaravanan/fd306b39376a30ece97e6f45cbe2d838 to your computer and use it in GitHub Desktop.
Save rambabusaravanan/fd306b39376a30ece97e6f45cbe2d838 to your computer and use it in GitHub Desktop.
Apache Log Stat Analyser
// Daily
awk '{print $4}' /var/log/apache2/$1/access.log | cut -d: -f1 | uniq -c
// Hourly
grep "`date +%d/%b/%Y`" /var/log/apache2/$1/access.log | cut -d[ -f2 | cut -d] -f1 | awk -F: '{print $2":00"}' | sort -n | uniq -c
// IP-Based
grep 'text' /var/log/apache2/$1/access.log | cut -d' ' -f1 | sort | uniq -c | sort -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment