Skip to main content

Python logging handler for Logstash.

Project description

python-logstash

Python logging handler for Logstash.

Installation

Using pip:

pip install python-logstash

Using example

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))

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,
      },
  },
  '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.1.3.tar.gz (3.1 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for python-logstash-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1a48a1e19d73d28afd2d55aa572ee3f189cf0d594cd694df6b63eccebad66ee4
MD5 0a7c96bd52807c36d25fee9081b18d5d
BLAKE2b-256 955955109d2f1ab4174882781601c406f7ddb34ebde3c137ea663ace999f1696

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