Skip to content

Instantly share code, notes, and snippets.

@centminmod
Last active August 29, 2015 13:57
Show Gist options
  • Save centminmod/9542083 to your computer and use it in GitHub Desktop.
Save centminmod/9542083 to your computer and use it in GitHub Desktop.
Practical example usage for Centmin Mod v1.2.3-eva2000.07's addons/passenger.sh installer which installs Ruby, RubyGems, Node.js and Python Passenger. Use gem package request-log-analyzer for producing html web analytics reports for your Nginx access logs. Steps are below
1. From Centmin Mod v1.2.3-eva2000.07 addons/passenger.sh folder run and install ruby, rubygem, node.js and python passenger.
cd addons
chmod +x passenger.sh
./passenger.sh install
Once install is completed, log out of your SSH session and log back in
2. Now install request-log-analyzer via gem. Documentation at https://github.com/wvanbergen/request-log-analyzer and http://www.request-log-analyzer.com/
gem install request-log-analyzer
3. Now you can produce html and non-html reports of your Nginx web site's access_logs via this simple command below. Assuming your domain's access_log is at /home/nginx/domains/yourdomain.com/log/access.log
request-log-analyzer --format nginx /home/nginx/domains/yourdomain.com/log/access.log
or if you want to product a html formatted report in same /home/nginx/domains/yourdomain/loghtml/
cd /home/nginx/domains/yourdomain/loghtml/
request-log-analyzer --format nginx /home/nginx/domains/yourdomain.com/log/access.log -o HTML --file yourdomain.com-access-report.html
if you want to timestampe the html file, use a revised set of commands
DT=`date +"%d%m%y-%H%M%S"`
cd /home/nginx/domains/yourdomain/loghtml/
request-log-analyzer --format nginx /home/nginx/domains/yourdomain.com/log/access.log -o HTML --file yourdomain.com-access-report_${DT}.html
##################
Notes:
- For Centmin Mod by default static files are not logged to access log. You can see this in /usr/local/nginx/conf/staticfiles.conf which has each context container with access_log off; set. If you want to log the static files too, just comment out with hash # in front all instances of access_log off; and restart Nginx web server
##################
More documentation
- https://github.com/wvanbergen/request-log-analyzer/wiki
- https://github.com/wvanbergen/request-log-analyzer/wiki/Basic-usage
- https://github.com/wvanbergen/request-log-analyzer/wiki/In-depth-analysis
- https://github.com/wvanbergen/request-log-analyzer/wiki/Creating-a-request-database
- https://github.com/wvanbergen/request-log-analyzer/wiki/Creating-your-own-file-format-definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment