Skip to content

Instantly share code, notes, and snippets.

@WintersMichael
Created November 10, 2014 19:43
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save WintersMichael/c70d195c5c5670d1625f to your computer and use it in GitHub Desktop.
Save WintersMichael/c70d195c5c5670d1625f to your computer and use it in GitHub Desktop.
Shell one-liner to parse apache access logs and extract a unique URL list with hit count, querystring excluded.
cat access.log | awk -F\" '{print $2}' | awk '{print $2}' | sed '/^$/d' | sed 's/\?.*//g' | sort | uniq -c | sort -rn > url_hits.txt
@rickyok
Copy link

rickyok commented Nov 15, 2017

Thankss! Just what i need to find a rogue php in my wordpress folder :P

@valeriogentileweplus
Copy link

best one-line-script ever

@virtualize
Copy link

Very helpful. Thanks a lot.

@turbcool
Copy link

turbcool commented Apr 1, 2020

Thanks, this helped a lot!

@davidoram
Copy link

Thanks, very useful

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