All Projects → piglei → Uwsgi Sloth

piglei / Uwsgi Sloth

Licence: apache-2.0
Realtime uwsgi log file analyzer, slow requests analyzer.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Uwsgi Sloth

django-setup
Setup Django application with Nginx and uWSGI on a Ubuntu server
Stars: ✭ 12 (-94.09%)
Mutual labels:  uwsgi
Uwsgi Nginx Docker
Docker image with uWSGI and Nginx for applications in Python 3.5 and above and Python 2.7 (as Flask) in a single container. Optionally with Alpine Linux.
Stars: ✭ 466 (+129.56%)
Mutual labels:  uwsgi
Shorty
🔗 A URL shortening service built using Flask and MySQL
Stars: ✭ 78 (-61.58%)
Mutual labels:  uwsgi
is-osm-uptodate
Find outdated nodes in OpenStreetMap
Stars: ✭ 16 (-92.12%)
Mutual labels:  uwsgi
Docker Django Nginx Uwsgi Postgres Tutorial
Docker + Django + Nginx + uWSGI + Postgres 基本教學 - 從無到有 ( Docker + Django + Nginx + uWSGI + Postgres Tutorial )
Stars: ✭ 334 (+64.53%)
Mutual labels:  uwsgi
Cutelyst
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Stars: ✭ 671 (+230.54%)
Mutual labels:  uwsgi
go-uwsgi
uwsgi implement for go
Stars: ✭ 51 (-74.88%)
Mutual labels:  uwsgi
Crawlerhot
今日热榜 抓取网站热榜信息,并且前端进行展示
Stars: ✭ 158 (-22.17%)
Mutual labels:  uwsgi
Autoops
linux资产管理,cmdb,django, webssh,运维管理平台,数据库操作平台 本项目已停止开发!因长时间未对代码进行维护,可能会造成项目在不同环境上无法部署、运行BUG等问题,请知晓!项目仅供参考!
Stars: ✭ 340 (+67.49%)
Mutual labels:  uwsgi
Flask Restful Authentication
An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).
Stars: ✭ 63 (-68.97%)
Mutual labels:  uwsgi
sgi
Socket Gateway Interface
Stars: ✭ 16 (-92.12%)
Mutual labels:  uwsgi
Pyflame
🔥 Pyflame: A Ptracing Profiler For Python. This project is deprecated and not maintained.
Stars: ✭ 2,930 (+1343.35%)
Mutual labels:  uwsgi
Django Uwsgi Taskmanager
Django application to monitor and manage long and/or recurring tasks through uWSGI.
Stars: ✭ 22 (-89.16%)
Mutual labels:  uwsgi
fano
Pascal web application framework
Stars: ✭ 21 (-89.66%)
Mutual labels:  uwsgi
Pyblog
Pyblog 是一个简单易用的在线 Markdown 博客系统,它使用 Python 的 flask 架构,理论上支持所有 flask-sqlalchemy 所能支持的数据库。 编辑器使用的是 editor.md。当前版本(v2.0)支持且仅支持 python3! Python 的 Markdown to HTML 编译器使用的是 Mistune! Just so!
Stars: ✭ 113 (-44.33%)
Mutual labels:  uwsgi
HomePage
Python Django开发管理后台+Bootstrap响应式网站
Stars: ✭ 32 (-84.24%)
Mutual labels:  uwsgi
Opman Django
💯✅自动化运维平台:CMDB、CI/CD、DevOps、资产管理、任务编排、持续交付、系统监控、运维管理、配置管理
Stars: ✭ 539 (+165.52%)
Mutual labels:  uwsgi
Docker Django
A project to get you started with Docker and Django.
Stars: ✭ 170 (-16.26%)
Mutual labels:  uwsgi
Django Init
Project template used at Fueled for scaffolding new Django based projects. 💫
Stars: ✭ 126 (-37.93%)
Mutual labels:  uwsgi
Uwsgi cli
easy uwsgi cli tools !!!
Stars: ✭ 48 (-76.35%)
Mutual labels:  uwsgi

uwsgi-sloth

uwsgi-sloth is a realtime uwsgi log analyer, designed for helping optimization of uwsgi app's performance.

It can both generates a static report file <http://www.zlovezl.cn/static/uwsgi-sloth-report-example.html>_ or analyze your log file in realtime.

Image preview:

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

You should consider using uwsgi-sloth if your website are running under uwsgi and have no conception of how slow/fast your website is.

QuickStart

Install ^^^^^^^

uwsgi-sloth is written in python, to install it, simply use pip:

.. code-block:: bash

# Install a stable version
$ pip install uwsgi-sloth

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

uwsgi-sloth now only supports Python3.5 and above, for Python2 users, please install uwsgi-sloth<3.0.0 instead.

Static report ^^^^^^^^^^^^^

After installation, you can analyzing your uwsgi log using uwsgi-sloth analyze command.

.. code-block:: bash

# 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

Check more: uwsgi-sloth analyze_

Realtime reports ^^^^^^^^^^^^^^^^

We do support a more powerful feature: realtime uwsgi log report. It's a little more complicated to configure.

First, create a default config file using uwsgi-sloth echo_conf:

.. code-block:: bash

uwsgi-sloth echo_conf > /data/uwsgi_sloth/myblog.conf

The default config file are like this:

.. code-block:: ini

# A sample uwsgi-sloth config file

# uwsgi log path, only support default log format
uwsgi_log_path = '/your_uwsgi_logs/web.log'

# All HTML files and data files will store here, must have read/write permissions
data_dir = '/you_data/uwsgi-sloth/'                          

# Minimal msecs for detect slow requests, default to 200
# min_msecs = 200

# Domain for your website, best given
domain = 'http://www.yourwebsite.com/'

# Custom url regular expressions file
# url_file = '/your_custom_url_file_path'

After modified uwsgi_log_path and data_dir, your can start uwsgi-sloth worker via uwsgi-sloth start -c /data/uwsgi_sloth/myblog.conf command, if everything goes fine, you will see some messages like this: ::

[2014-06-26 01:32:56,851] uwsgi_sloth INFO: Start from last savepoint, last_log_datetime: 2014-06-26 09:32:04
[2014-06-26 01:32:58,859] uwsgi_sloth INFO: Rendering HTML file /data/uwsgi_sloth/myblog/html/latest_5mins.html...
... ...

This may take several seconds if your log file are big.

Demonize


uwsgi-sloth does not support built-in deamonize option, so you may need tools like
`supervisor <https://github.com/Supervisor/supervisor>`_ to manage this process.

Serve your reports

Now, HTML files have been generated, we should configure our webserver so we can visit it, this configuration is for nginx: ::

$ cat /etc/nginx/sites-enabled/sloth_myblog.conf
server {

    listen   80;
    server_name  uwsgi-sloth.zlovezl.cn;

    location / {
        root /data/uwsgi_sloth/myblog/html/;
        index "latest_5mins.html";
    }
}

After reloading your nginx config, open your browser then you will see the fancy reports waiting for you.

Commands

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
  --limit-url-groups LIMIT_URL_GROUPS
                        Number of url groups considered, default: 200
  --limit-per-url-group LIMIT_PER_URL_GROUP
                        Number of urls per group considered, default: 20

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 echo_conf
^^^^^^^^^^^^^^^^^^^^^

Print a default config file


uwsgi-sloth start
^^^^^^^^^^^^^^^^^

Start uwsgi-sloth worker to generate realtime report

::

    $ uwsgi-sloth start -h
    usage: uwsgi-sloth start [-h] -c CONFIG

    optional arguments:
      -h, --help            show this help message and exit
      -c CONFIG, --config CONFIG
                            uwsgi-sloth config file, use "uwsgi-sloth echo_conf"
                            for a default one

Notes
-----

- Only default uwsgi log format is supported at present.
- Tested under python 2.6/2.7
- By default, uwsgi-sloth will classify ``url_path`` by replacing sequential
  digits part by '(\d+)': ``/users/3074/`` -> ``/users/(\d+)``


Any feedbacks are greatly welcomed!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].