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.
Release files for syslog-rfc5424-formatter 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| syslog-rfc5424-formatter-1.2.3.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| syslog_rfc5424_formatter-1.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / syslog-rfc5424-formatter-1.2.3.tar.gz
| Download URL | syslog-rfc5424-formatter-1.2.3.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bc5c9c3fb6a92b6f85ca108f2be04ea50106113324b5d7b1f07fcc6ad2766d3
|
|
BLAKE2b-256 checksum How to use checksums |
b151882bc5987d3924fa0c259459195b0ff478fc97cdf9a375f6d5219d1525e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.12
|
Release files / syslog_rfc5424_formatter-1.2.3-py3-none-any.whl
| Download URL | syslog_rfc5424_formatter-1.2.3-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
958b9896097fea58e271b95f70aa71d5330882a888f685f2ca8aac872be5efa3
|
|
BLAKE2b-256 checksum How to use checksums |
299483e7fd5a49165cb98ac01c57748c2f9a7ba8aeee1a154aa6843a2bed74a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.12
|