Skip to main content

A simple uwsgi access log analyzer

Project description

uwsgi-sloth is a small tool for analyzing uwsgi log files, it can generates a well-looking report showing the slowest requests in your website.

It’s a great tool when optimizing your uwsgi web apps.

Preview

This html is generated by uwsgi-sloth:

https://github.com/piglei/uwsgi-sloth/raw/master/uwsgi-sloth-screenshot.png

Install

To install uwsgi-sloth, simply use pip:

# Install a stable version
$ pip install uwsgi-sloth

# Install from github
$ pip install -e git+https://github.com/piglei/uwsgi-sloth#egg=uwsgi-sloth

Tutorial

# Generate a report
$ uwsgi-sloth analyze -f uwsgi_access.log --output=report.html

# Specify threshold for request process time
$ uwsgi-sloth analyze -f uwsgi_access.log --output=report.html --min-msecs=400

Using a customized url rules

First, get a list of url regular expressions.

$ cat url_rules
# A valid url_rules file are seperated regular expressions
^club/(?P<place>\w+)/(?P<year>\d+)/(?P<issue>\d+)/signup/$
^club/signup/success/$
^club/checkin/success/$

Using –url-file to specify this url_rules

$ uwsgi-sloth analyze -f uwsgi_access.log --output=report.html --url-file=url_rules

uwsgi-sloth analyze

Available arguments

usage: uwsgi-sloth analyze [-h] -f FILEPATH [--output OUTPUT]
                           [--min-msecs MIN_MSECS] [--domain DOMAIN]
                           [--url-file URL_FILE]

optional arguments:
  -h, --help            show this help message and exit
  -f FILEPATH, --filepath FILEPATH
                        Path of uwsgi log file
  --output OUTPUT       HTML report file path
  --min-msecs MIN_MSECS
                        Request serve time lower than this value will not be
                        counted, default: 200
  --domain DOMAIN       Make url in report become a hyper-link by settings a
                        domain
  --url-file URL_FILE   Customized url rules in regular expression

Notes

  • Only default uwsgi log format is supported at present.

  • By default, uwsgi-sloth will classify url_path by replacing sequential digits part by ‘(d+)’: /users/3074/ -> /users/(\d+)

Any feedbacks are greatly welcomed!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uwsgi-sloth-1.0.2.tar.gz (6.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page