Skip to main content
Help us improve Python packaging – donate today!

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).

Release history Release notifications

This version
History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
syslog-rfc5424-formatter-1.0.0.tar.gz (3.9 kB) Copy SHA256 hash SHA256 Source None Mar 23, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page