{"id":13502247,"url":"https://github.com/piglei/uwsgi-sloth","last_synced_at":"2025-04-05T20:05:28.553Z","repository":{"id":17911173,"uuid":"20872051","full_name":"piglei/uwsgi-sloth","owner":"piglei","description":"Realtime uwsgi log file analyzer, slow requests analyzer.","archived":false,"fork":false,"pushed_at":"2023-10-02T15:56:46.000Z","size":164,"stargazers_count":209,"open_issues_count":3,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T19:04:15.985Z","etag":null,"topics":["python","uwsgi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piglei.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-06-16T03:49:23.000Z","updated_at":"2024-11-26T14:33:23.000Z","dependencies_parsed_at":"2024-01-18T02:36:36.363Z","dependency_job_id":"2432a1fd-e60f-4f5f-8462-c496d64f0fd3","html_url":"https://github.com/piglei/uwsgi-sloth","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.1351351351351351,"last_synced_commit":"cac86de5a9a4c43728b3941628d9fd55910252ce"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piglei%2Fuwsgi-sloth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piglei%2Fuwsgi-sloth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piglei%2Fuwsgi-sloth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piglei%2Fuwsgi-sloth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piglei","download_url":"https://codeload.github.com/piglei/uwsgi-sloth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393568,"owners_count":20931812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","uwsgi"],"created_at":"2024-07-31T22:02:07.571Z","updated_at":"2025-04-05T20:05:28.529Z","avatar_url":"https://github.com/piglei.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"uwsgi-sloth\n===========\n\nuwsgi-sloth is a realtime uwsgi log analyer, designed for helping optimization\nof uwsgi app's performance.\n\nIt can both generates `a static report file \u003chttp://www.zlovezl.cn/static/uwsgi-sloth-report-example.html\u003e`_ \nor analyze your log file in realtime.\n\nImage preview:\n\n.. image:: https://github.com/piglei/uwsgi-sloth/raw/master/uwsgi-sloth-screenshot.png\n\n\nYou should consider using uwsgi-sloth if your website are running under uwsgi\nand have no conception of how slow/fast your website is.\n\nQuickStart\n----------\n\nInstall\n^^^^^^^\n\nuwsgi-sloth is written in python, to install it, simply use pip:\n\n.. code-block:: bash\n\n    # Install a stable version\n    $ pip install uwsgi-sloth\n\n    # Install the latest version from github\n    $ pip install -e git+https://github.com/piglei/uwsgi-sloth#egg=uwsgi-sloth\n\n**uwsgi-sloth now only supports Python3.5 and above, for Python2 users, please install uwsgi-sloth\u003c3.0.0 instead.**\n\nStatic report\n^^^^^^^^^^^^^\n\nAfter installation, you can analyzing your uwsgi log using ``uwsgi-sloth analyze``\ncommand.\n\n.. code-block:: bash\n\n    # Generate a report\n    $ uwsgi-sloth analyze -f uwsgi_access.log --output=report.html\n\n    # Specify threshold for request process time\n    $ uwsgi-sloth analyze -f uwsgi_access.log --output=report.html --min-msecs=400\n\nCheck more: `uwsgi-sloth analyze`_\n    \nRealtime reports\n^^^^^^^^^^^^^^^^\n\nWe do support a more powerful feature: realtime uwsgi log report.\nIt's a little more complicated to configure.\n\nFirst, create a default config file using ``uwsgi-sloth echo_conf``:\n\n.. code-block:: bash\n\n    uwsgi-sloth echo_conf \u003e /data/uwsgi_sloth/myblog.conf\n\nThe default config file are like this:\n\n.. code-block:: ini\n\n    # A sample uwsgi-sloth config file\n\n    # uwsgi log path, only support default log format\n    uwsgi_log_path = '/your_uwsgi_logs/web.log'\n\n    # All HTML files and data files will store here, must have read/write permissions\n    data_dir = '/you_data/uwsgi-sloth/'                          \n\n    # Minimal msecs for detect slow requests, default to 200\n    # min_msecs = 200\n\n    # Domain for your website, best given\n    domain = 'http://www.yourwebsite.com/'\n\n    # Custom url regular expressions file\n    # url_file = '/your_custom_url_file_path'\n\nAfter modified ``uwsgi_log_path`` and ``data_dir``, your can start uwsgi-sloth\nworker via ``uwsgi-sloth start -c /data/uwsgi_sloth/myblog.conf`` command, if\neverything goes fine, you will see some messages like this: ::\n\n    [2014-06-26 01:32:56,851] uwsgi_sloth INFO: Start from last savepoint, last_log_datetime: 2014-06-26 09:32:04\n    [2014-06-26 01:32:58,859] uwsgi_sloth INFO: Rendering HTML file /data/uwsgi_sloth/myblog/html/latest_5mins.html...\n    ... ...\n\nThis may take several seconds if your log file are big.\n\nDemonize\n~~~~~~~~\n\nuwsgi-sloth does not support built-in deamonize option, so you may need tools like\n`supervisor \u003chttps://github.com/Supervisor/supervisor\u003e`_ to manage this process.\n\nServe your reports\n~~~~~~~~~~~~~~~~~~\n\nNow, HTML files have been generated, we should configure our \nwebserver so we can visit it, this configuration is for nginx: ::\n\n\n    $ cat /etc/nginx/sites-enabled/sloth_myblog.conf\n    server {\n\n        listen   80;\n        server_name  uwsgi-sloth.zlovezl.cn;\n\n        location / {\n            root /data/uwsgi_sloth/myblog/html/;\n            index \"latest_5mins.html\";\n        }\n    }\n\nAfter reloading your nginx config, open your browser then you will see the fancy\nreports waiting for you.\n\nCommands\n--------\n\nuwsgi-sloth analyze\n^^^^^^^^^^^^^^^^^^^\n\nAvailable arguments\n\n::\n\n    usage: uwsgi-sloth analyze [-h] -f FILEPATH [--output OUTPUT]\n                               [--min-msecs MIN_MSECS] [--domain DOMAIN]\n                               [--url-file URL_FILE]\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -f FILEPATH, --filepath FILEPATH\n                            Path of uwsgi log file\n      --output OUTPUT       HTML report file path\n      --min-msecs MIN_MSECS\n                            Request serve time lower than this value will not be\n                            counted, default: 200\n      --domain DOMAIN       Make url in report become a hyper-link by settings a\n                            domain\n      --url-file URL_FILE   Customized url rules in regular expression\n      --limit-url-groups LIMIT_URL_GROUPS\n                            Number of url groups considered, default: 200\n      --limit-per-url-group LIMIT_PER_URL_GROUP\n                            Number of urls per group considered, default: 20\n\n\nUsing a customized url rules\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFirst, get a list of url regular expressions.\n\n::\n\n    $ cat url_rules\n    # A valid url_rules file are seperated regular expressions\n    ^club/(?P\u003cplace\u003e\\w+)/(?P\u003cyear\u003e\\d+)/(?P\u003cissue\u003e\\d+)/signup/$\n    ^club/signup/success/$\n    ^club/checkin/success/$\n\nUsing `--url-file` to specify this url_rules\n\n::\n\n    $ uwsgi-sloth analyze -f uwsgi_access.log --output=report.html --url-file=url_rules\n\nuwsgi-sloth echo_conf\n^^^^^^^^^^^^^^^^^^^^^\n\nPrint a default config file\n\n\nuwsgi-sloth start\n^^^^^^^^^^^^^^^^^\n\nStart uwsgi-sloth worker to generate realtime report\n\n::\n\n    $ uwsgi-sloth start -h\n    usage: uwsgi-sloth start [-h] -c CONFIG\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -c CONFIG, --config CONFIG\n                            uwsgi-sloth config file, use \"uwsgi-sloth echo_conf\"\n                            for a default one\n\nNotes\n-----\n\n- Only default uwsgi log format is supported at present.\n- Tested under python 2.6/2.7\n- By default, uwsgi-sloth will classify ``url_path`` by replacing sequential\n  digits part by '(\\d+)': ``/users/3074/`` -\u003e ``/users/(\\d+)``\n\n\nAny feedbacks are greatly welcomed!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiglei%2Fuwsgi-sloth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiglei%2Fuwsgi-sloth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiglei%2Fuwsgi-sloth/lists"}