Skip to main content

Python logging handler for Logstash.

Project description

python-logstash

Python logging handler for Logstash. http://logstash.net/

Changelog

0.3.1
  • Added support for Python 3

0.2.2
  • Split Handler into Handler and Formatter classes

0.2.1

Installation

Using pip:

pip install python-logstash

Usage

LogstashHandler is a custom logging handler which sends Logstash messages using UDP.

For example:

import logging
import logstash

test_logger = logging.getLogger('test_logger')
test_logger.setLevel(logging.INFO)
test_logger.addHandler(logstash.LogstashHandler('localhost', 5959, version=1))

test_logger.info('Test logstash message.')

Using with Django

Modify your settings.py to integrate python-logstash with Django’s logging:

LOGGING = {
  ...
  'handlers': {
      'logstash': {
          'level': 'DEBUG',
          'class': 'logstash.LogstashHandler',
          'host': 'localhost',
          'port': 5959,
          'version': 1,
      },
  },
  'loggers': {
      'django.request': {
          'handlers': ['logstash'],
          'level': 'DEBUG',
          'propagate': True,
      },
  },
  ...
}

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

python-logstash-0.3.1.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file python-logstash-0.3.1.tar.gz.

File metadata

File hashes

Hashes for python-logstash-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c40317d326a21dcfd2ac8b87e32a6717b8a5bd9533300d72cba20f0b7f87a5ba
MD5 fbc26256f378cdd5f44f37ae2ff457fa
BLAKE2b-256 01d228eaf2bd31e160aaf40339339ef08d8693288ab1c3d22b8faad601137529

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