Skip to main content

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.

CI PyPI version Documentation Status

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

syslog-rfc5424-formatter-1.2.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

syslog_rfc5424_formatter-1.2.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file syslog-rfc5424-formatter-1.2.3.tar.gz.

File metadata

  • Download URL: syslog-rfc5424-formatter-1.2.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for syslog-rfc5424-formatter-1.2.3.tar.gz
Algorithm Hash digest
SHA256 9bc5c9c3fb6a92b6f85ca108f2be04ea50106113324b5d7b1f07fcc6ad2766d3
MD5 d79e4ede143409c22b66575ada5f4948
BLAKE2b-256 b151882bc5987d3924fa0c259459195b0ff478fc97cdf9a375f6d5219d1525e3

See more details on using hashes here.

File details

Details for the file syslog_rfc5424_formatter-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: syslog_rfc5424_formatter-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for syslog_rfc5424_formatter-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 958b9896097fea58e271b95f70aa71d5330882a888f685f2ca8aac872be5efa3
MD5 4ff287709bbc3f3f3966fd81ba415ea7
BLAKE2b-256 299483e7fd5a49165cb98ac01c57748c2f9a7ba8aeee1a154aa6843a2bed74a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page