SysLogHandler with TLS
Project description
Python logging.handler as a drop-in replacement for logging.SysLogHandler with support for sending syslog messages over TCP with TLS.
Installation
pip install tlssysloghandler
Usage
import logging
from tlssysloghandler import TLSSysLogHandler
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# with default system certificate store
handler1 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), secure=True)
logger.addHandler(handler1)
# with custom certificates, via cafile/capath/cadata
# refer to https://docs.python.org/3/library/ssl.html#ssl.create_default_context
handler2 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
secure=(cafile='/path/to/ca/file'))
logger.addHandler(handler2)
# with custom SSLContext
context = ssl.create_default_context(cafile='/path/to/ca/file')
handler3 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
secure=context)
logger.addHandler(handler3)
# or allow TLS without verification
handler4 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
secure="noverify")
logger.addHandler(handler4)
logger.info('Hello World!')
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
tlssysloghandler-1.0.1.tar.gz
(6.5 kB
view hashes)
Built Distribution
Close
Hashes for tlssysloghandler-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c4075c1d9b0090004271bad1defd7e99f25e405651eecd19cb9cef1392a177 |
|
MD5 | 2aa30ced7fc3eb6642fc377d0bd20fe0 |
|
BLAKE2b-256 | 1e6fba63c6684763606a5e2beb9f0f95328b6ffbac19c004b01604246c429440 |