Skip to content

Instantly share code, notes, and snippets.

@snopoke
Created May 20, 2019 12:47
Show Gist options
  • Save snopoke/fbaf1c1d4ab22309926463f7ac1895c5 to your computer and use it in GitHub Desktop.
Save snopoke/fbaf1c1d4ab22309926463f7ac1895c5 to your computer and use it in GitHub Desktop.
cat icds_cas_commcare-nginx_access.log | cut -d' ' -f 10,14 > cas_logs.txt
cat icds_cas_commcare-nginx_access.log.1 | cut -d' ' -f 10,14 >> cas_logs.txt
cat icds_commcare-nginx_access.log | cut -d' ' -f 10,14 >> cas_logs.txt
zcat icds_cas_commcare-nginx_access.log.*.gz | cut -d' ' -f 10,14 >> cas_logs.txt
echo -n 'Total,'; echo awk '{s+=$2}END{print s}' cas_logs.txt
echo -n 'App audio downloads,'; cat cas_logs.txt | grep CommCareAudio | awk '{s+=$2}END{print s}'
echo -n 'App video downloads,'; cat cas_logs.txt | grep CommCareVideo | awk '{s+=$2}END{print s}'
echo -n 'App image downloads,'; cat cas_logs.txt | grep CommCareImage | awk '{s+=$2}END{print s}'
echo -n 'Static files,'; cat cas_logs.txt | grep static | awk '{s+=$2}END{print s}'
echo -n 'Dashboard image downloads,'; cat cas_logs.txt | grep icds_image_accessor | awk '{s+=$2}END{print s}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment