Skip to main content

Build status Code health Python versions Software license

Sentry Logs allows you to send logs to Sentry. Only Nginx error log is currently supported, but extending the library to support more log files is planned.

How It Works

To install sentrylogs you can use pip or easy_install:

$ pip install sentrylogs
$ easy_install sentrylogs

This will install the module and will provide a new console command:

$ sentrylogs -h

usage: sentrylogs [-h] [--sentryconfig SENTRYCONFIG] [--sentrydsn SENTRYDSN]
                  [--daemonize] [--follow FOLLOW]
                  [--nginxerrorpath NGINXERRORPATH]

Send logs to Django Sentry.

optional arguments:
  -h, --help            show this help message and exit
  --sentryconfig SENTRYCONFIG, -c SENTRYCONFIG
                        A configuration file (.ini, .yaml) of some Sentry
                        integration to extract the Sentry DSN from
  --sentrydsn SENTRYDSN, -s SENTRYDSN
                        The Sentry DSN string (overrides -c)
  --daemonize, -d       Run this script in background
  --follow FOLLOW, -f FOLLOW
                        Which logs to follow, default ALL
  --nginxerrorpath NGINXERRORPATH, -n NGINXERRORPATH
                        Nginx error log path

Sentry DSN

We need to provide a Sentry DSN to send messages to the Sentry server. There are 3 options to do this:

  1. Use the --sentryconfig command line argument to read the configuration file of your Sentry integration, or

  2. Use the --sentrydsn command line argument to specify the DSN directly, or

  3. Provide an environment variable.

$ sentrylogs --sentryconfig /opt/myapp/config/pyramid.ini
$ sentrylogs --sentrydsn 'protocol://public:secret@example.com/#'
$ export SENTRY_DSN='protocol://public:secret@example.com/#' && sentrylogs

Log File Location

By default sentrylogs will assume the nginx log at /var/log/nginx/error.log. You can change this using the --nginxerrorpath argument.

Run as Daemon

If you use --daemonize the command will daemonize itself and run in background.

How to Contribute

Please open an issue to discuss your plans for a pull request. After writing code make sure your changes pass our quality gate before you push.

$ tox
$ python setup.py clean

Please write tests! Test coverage is still low and the code quality needs to improve. Please help by adding tests with each contribution you make!

Release files for SentryLogs 0.5.0

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

Source distribution (sdist)

Source distribution for SentryLogs 0.5.0
File Size Uploaded
SentryLogs-0.5.0.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SentryLogs 0.5.0
File Interpreter ABI Platform
SentryLogs-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / SentryLogs-0.5.0.tar.gz

Download URL SentryLogs-0.5.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
696c4d914f3a038f881549dca120f6e31bc543610cfc9b165883d64a48274fc3
BLAKE2b-256 checksum
How to use checksums
b75e2cde561b64cb80583775a941310e4a30aa142893902b373e5eca34608fbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / SentryLogs-0.5.0-py3-none-any.whl

Download URL SentryLogs-0.5.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
889c872eef489af07b19bf853308f247a2fadab5bb4704efd4b9ba2d79ad0532
BLAKE2b-256 checksum
How to use checksums
8cfa0cde9f54ca7004a64f04f5c1cadbc5dcfdf4b1667e998bf318373ec8ff05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

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