Python logging handler for Logstash.
Project description
python-logstash
Python logging handler for Logstash.
Changelog
- 0.2.1
Added support for the new JSON schema in Logstash 1.2.x. See details in http://tobrunet.ch/2013/09/logstash-1-2-0-upgrade-notes-included/ and https://logstash.jira.com/browse/LOGSTASH-675
Added version parameter. Available values: 1 (Logstash 1.2.x version format), 0 - default (previous version).
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
Release history Release notifications | RSS feed
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.1.tar.gz
(3.7 kB
view details)
File details
Details for the file python-logstash-0.2.1.tar.gz
.
File metadata
- Download URL: python-logstash-0.2.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00454a5ff1cadd46c57f309866983502ea47322e6baae1a33ee23c8b7aaada25 |
|
MD5 | 01902055864447d4cfb3f487fc5256fc |
|
BLAKE2b-256 | f08113d6404206269aa956c6c68121f2eee3c3ee72cbec470a08eb0bc04875f0 |