Skip to main content

An up-to-date, RFC5424-Compliant syslog handler for the Python logging framework

Project description

Python rfc5424 syslog logging handler

Codecov

This is a fork of a package with a logging handler with support for the RFC 5424 standard.

RFC 5424 (syslog structured data) compliant syslog handler for the Python logging framework.

Installation

pip install syslog-sd-logging

Usage

After installing you can use this package like this:

import logging
from syslog_sd_logging import Rfc5424SysLogHandler

logger = logging.getLogger('syslogtest')
logger.setLevel(logging.INFO)

sh = Rfc5424SysLogHandler(address=('10.0.0.1', 514))
logger.addHandler(sh)

logger.info('This is an interesting message', extra={'msgid': 'some_unique_msgid'})

This will send the following message to the syslog server::

<14>1 2020-01-01T05:10:20.841485+01:00 myserver syslogtest 5252 some_unique_msgid - \xef\xbb\xbfThis is an interesting message

Note the UTF8 Byte order mark (BOM) preceding the message. While required by RFC 5424 section 6.4 if the message is known to be UTF-8 encoded, there are still syslog receivers that cannot handle it. To bypass this limitation, when initializing the handler Class, set the msg_as_utf8 parameter to False like this:

sh = Rfc5424SysLogHandler(address=('10.0.0.1', 514), msg_as_utf8=False)

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_sd_logging-0.1.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syslog_sd_logging-0.1.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file syslog_sd_logging-0.1.1.tar.gz.

File metadata

  • Download URL: syslog_sd_logging-0.1.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for syslog_sd_logging-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5b6b86e3f23b43dfe1710474a47da38bd3944497503194df8c6d5b86119ae308
MD5 69dd484a8257f15aea9f528d5e6d22c0
BLAKE2b-256 d1a35840b59cb261ec8e390958e88f823050b5fd11c33cf86637ab625e38f32b

See more details on using hashes here.

Provenance

The following attestation bundles were made for syslog_sd_logging-0.1.1.tar.gz:

Publisher: release.yml on redb0/syslog-sd-logging

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file syslog_sd_logging-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for syslog_sd_logging-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d0b3a6f058b25a5d371ddb588511136bd994b4e5a6d79217e41a0f5e07cfa8b
MD5 fe3a61d81d65bf869208610c9f19e585
BLAKE2b-256 995082086cf7e8e1e3f77aead5a97318956ab1d08d6757a83aada117c5ebfb6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for syslog_sd_logging-0.1.1-py3-none-any.whl:

Publisher: release.yml on redb0/syslog-sd-logging

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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