Skip to main content

Python logging handler for Logstash.

Project description

python-logstash

Python logging handler for Logstash.

Changelog

0.2.0

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.2.0.tar.gz (3.8 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for python-logstash-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8b58a032009524ea07a2b44561bc80f22d9016150aa2df30080265ac9aba041f
MD5 7ecd8f39ff63c9458c683e75eb11b286
BLAKE2b-256 2493a8ca2b1fb295dd3ced8cef0d3f416ed298d8cd5113fba5d70446088e0ecd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page