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.

[![Circle CI](https://circleci.com/gh/EasyPost/syslog-rfc5424-formatter.svg?style=svg)](https://circleci.com/gh/EasyPost/syslog-rfc5424-formatter)

## Usage

If you're configuring your loggers from code, you should use this formatter as below:

```python
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.dictConfig`, your config file should look like the following (assuming YAML concrete syntax):

```yaml
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](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.0.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distributions

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

syslog_rfc5424_formatter-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

syslog_rfc5424_formatter-1.0.0-py2-none-any.whl (3.9 kB view details)

Uploaded Python 2

File details

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

File metadata

File hashes

Hashes for syslog-rfc5424-formatter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a873cd067311b7a1c2a5e1dbad0911544d2e49f128914ef6b1f9c498601cb11a
MD5 27df0ccedd491d71f3833839739f8260
BLAKE2b-256 303f2c4ae711e440cbaf0c3a8d6e0a0aa2085f2244156aee636510cee974fd52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: syslog_rfc5424_formatter-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.2

File hashes

Hashes for syslog_rfc5424_formatter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f743c19ad2e4cdd9de721ef5c64dd59974c03f5fbadfcf0be1443866c6fca8c
MD5 3e7cdf216358f406ed37bec481b5ccd7
BLAKE2b-256 39b74c838c8a4b6a2cfe2ec62197b6dc0a5ad6d237124d083b993337de6e438b

See more details on using hashes here.

File details

Details for the file syslog_rfc5424_formatter-1.0.0-py2-none-any.whl.

File metadata

  • Download URL: syslog_rfc5424_formatter-1.0.0-py2-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2
  • 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.2

File hashes

Hashes for syslog_rfc5424_formatter-1.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 341407861bf79d2215cd89e026c94727b10433304cefc8d30da5e77d711b646b
MD5 c203fb38222826a82f562bf81f0dbe97
BLAKE2b-256 152f86b8689dd1c18585f974f8f0c91e0690db78cd349e307056669f30a16357

See more details on using hashes here.

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