Logging formatter which produces well-formatted RFC5424 Syslog Protocol messages
Project description
This module implements a python logging
formatter which produces well-formed RFC5424-compatible Syslog messages to a given socket.
Usage
If you're configuring your loggers from code, you should use this formatter as below:
import logging
import logging.handlers
from syslog_rfc5424_formatter import RFC5424Formatter
def set_up_logging():
h = logging.handlers.SysLogHandler('/path/to/syslog_socket')
h.setFormatter(RFC5424Formatter())
logging.getLogger('').addHandler(h)
If you're using a more modern combination of a JSON/YAML config file and logging.config.dictConfig
, your config file should look like the following (assuming YAML concrete syntax):
formatters:
syslog:
(): syslog_rfc5424_formatter.RFC5424Formatter
handlers:
syslog:
formatter: syslog
class: logging.handlers.SysLogHandler
address: "/path/to/syslog/socket"
facility: "ext://logging.handlers.SysLogHandler.LOG_USER"
root:
level: INFO
handlers:
- syslog
License
This work is licensed under the ISC license, the text of which can be found at LICENSE.txt.
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
Built Distribution
Close
Hashes for syslog-rfc5424-formatter-1.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bc5c9c3fb6a92b6f85ca108f2be04ea50106113324b5d7b1f07fcc6ad2766d3 |
|
MD5 | d79e4ede143409c22b66575ada5f4948 |
|
BLAKE2b-256 | b151882bc5987d3924fa0c259459195b0ff478fc97cdf9a375f6d5219d1525e3 |
Close
Hashes for syslog_rfc5424_formatter-1.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 958b9896097fea58e271b95f70aa71d5330882a888f685f2ca8aac872be5efa3 |
|
MD5 | 4ff287709bbc3f3f3966fd81ba415ea7 |
|
BLAKE2b-256 | 299483e7fd5a49165cb98ac01c57748c2f9a7ba8aeee1a154aa6843a2bed74a2 |