Skip to content

Instantly share code, notes, and snippets.

@hermes-pimentel
Last active December 27, 2017 12:59
Show Gist options
  • Select an option

  • Save hermes-pimentel/4d28e0764ff94af46c6e64a3b91e0762 to your computer and use it in GitHub Desktop.

Select an option

Save hermes-pimentel/4d28e0764ff94af46c6e64a3b91e0762 to your computer and use it in GitHub Desktop.
ELB/CF Parser
#download files from bucket
#group logs
cat *.log >> single.txt && mv single.txt single.log
#IPS GET
cat single.log| grep -v POST | awk '{print $3}' | cut -d : -f 1 | sort | uniq -c | sort -nr
#IPS POST
cat single.log| grep -v GET | awk '{print $3}' | cut -d : -f 1 | sort | uniq -c | sort -nr
#both
cat single.log | awk '{print $3}' | cut -d : -f 1 | sort | uniq -c | sort -nr
##### cloud frontlogs #####
#10+ GET
cat cloudfront.txt | grep -v POST | awk '{print $5}' | cut -d : -f 1 | sort | uniq -c | sort -nr | head -10
#10+ POST
cat cloudfront.txt | grep -v GET | awk '{print $5}' | cut -d : -f 1 | sort | uniq -c | sort -nr | head -10
#10+ all
cat cloudfront.txt | awk '{print $5}' | cut -d : -f 1 | sort | uniq -c | sort -nr | head -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment