Analyse CloudFront logs with goaccess

# Copy the files from the S3 bucket to your local machine
aws s3 cp s3://myapp-prod-logs/ $HOME/projects/corp/myapp-prod-logs/ --recursive

# Combine the zipped logs into a single file
# This does not work: 
#   gunzip -c E2PY27KA8GHG48*.gz >> E2PY27KA8GHG48.log
# so we loop over the archives instead:
for f in E2PY27KA8GHG48*.gz; do gunzip -c $f >> E2PY27KA8GHG48.log ; done

# Then create a new files without comment lines
egrep -v '^#.+' E2PY27KA8GHG48.log > E2PY27KA8GHG48-2.log

# Finally, create a report for all endpoints
cat E2PY27KA8GHG48-2.log | docker run --rm -i -e LANG=$LANG allinurl/goaccess -a -o html --log-format CLOUDFRONT - > report.html

# Or create a report only for the /dashboard endpoint
grep '/dashboard' E2PY27KA8GHG48-2.log | docker run --rm -i -e LANG=$LANG allinurl/goaccess -a -o html --log-format CLOUDFRONT - > report-dashboard.html