Skip to main content

What does this package do

Tail log files on your server and report by email if error occurs.

By default, the regex pattern was set for default uwsgi logs.

Install

pip install tail_uwsgi_log

Usage

tail_uwsgi_log -c your_config_filepath.ini

Configs

The config file provides infomations needed to send an email and log-files to tail.

For example:

; section name startswith 'log' would be interpreted as logfile config
[log-myapp1]

; log file path
filepath = your_log_filepath

; wait_time for tail command, the thread will sleep and wait
; the wait_time should be small if the server is busy and generates log lines quickly
wait_time = 0.5

; the regex pattern to read the log line, the line doesn't match this regex will be recorded as innormal
pattern = 

; mail settings
mail_recipients = example1@example.com, example2@example.com

mail_host = smtp.qq.com
mail_port = 465
mail_sender = your_email_address
mail_password = your_password

To tail several log files at the same time, we could set several sections on config files, the section name should start with 'log'.

For mail settings, we could use a section named 'mail' to set default value. The default value will be used if not set in log section.

For example:

[log-myapp1]
filepath = your_log_filepath1
wait_time = 0.5
pattern = 
mail_recipients = example1@example.com, example2@example.com

[log-myapp2]
filepath = your_log_filepath2
wait_time = 1
pattern = 
mail_recipients = example3@example.com, example4@example.com

[mail]
mail_host = smtp.qq.com
mail_port = 465
mail_sender = your_email_address
mail_password = your_password

The default regex pattern to match the logline was for default uwsgi logs, which is:

pattern = r'''\]\ (?P<ip>.*?)\ (.*)\ {.*?}\ \[(?P<datetime>.*?)\]\ (?P<request_method>POST|GET|DELETE|PUT|PATCH)\s
            (?P<request_uri>[^ ]*?)\ =>\ generated\ (?:.*?)\ in\ (?P<resp_msecs>\d+)\ msecs\s
            \(HTTP/[\d.]+\ (?P<resp_status>\d+)\)'''

The 'resp_status' in the pattern is important, which will be used as a signal.

When the resp_status is 500, an email will be sent with all innormal log lines recorded before.

Metadata

Release files for tail-uwsgi-log 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tail-uwsgi-log 0.0.4
File Size Uploaded Provenance Actions
tail_uwsgi_log-0.0.4.tar.gz 5.1 kB Without provenance Details for tail_uwsgi_log-0.0.4.tar.gz

Release files / tail_uwsgi_log-0.0.4.tar.gz

Download URL tail_uwsgi_log-0.0.4.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d5e3036d20ef560b25a3130445f280fcbd480f1e01eaf9bc199b181f080657bb
BLAKE2b-256 checksum
How to use checksums
70f2728b24666ace60607de64390a04d892ed0702750fc6fdb2961bce51404be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2

Security for tail-uwsgi-log 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page