Skip to main content

Send logs to Django Sentry.

Project description

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.

$ python setup.py test         # run all tests with active Python version
$ python setup.py clean        # remove all build files and byte code
$ python setup.py clean test   # start a clean test run (to fix test issues)

Please write tests! Our test infrastructure is in place, however our tests are still very basic (static code analysis over all files, and integration tests for the command line script).

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

SentryLogs-0.3.0.tar.gz (12.7 kB view details)

Uploaded Source

File details

Details for the file SentryLogs-0.3.0.tar.gz.

File metadata

  • Download URL: SentryLogs-0.3.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for SentryLogs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 371c18bdd44ac82f6489efb5433a3c0a0159017469bbb2c3974d9c5b1400eccf
MD5 e181b7b65494ab56ca4954aff252173c
BLAKE2b-256 ec07cb842d646ecf24d0d3fc49bd08cb6f39d94bf1d756921121a35da84e6408

See more details on using hashes here.

Provenance

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