Python Logstash Handler

Python Logstash Async is an asynchronous Python logging handler to submit log events to a remote Logstash instance.

Unlike most other Python Logstash logging handlers, this package works asynchronously by collecting log events from Python’s logging subsystem and then transmitting the collected events in a separate worker thread to Logstash. This way, the main application (or thread) where the log event occurred, doesn’t need to wait until the submission to the remote Logstash instance succeeded.

This is especially useful for applications like websites or web services or any kind of request serving API where response times matter.

This Python logging handler is a fork of https://github.com/vklochan/python-logstash. It adds the following features:

  • Asynchronous transport of log events
  • Store log events temporarily in a cache until transport to the Logstash server has been successful
  • Transport of events via TCP, UDP the Beats protocol
  • TCP transport optionally SSL-encrypted
  • Special formatter ready to be used in Django projects
  • Special formatter ready to be used in Flask projects

For more details, configuration options and usage examples please see the documentation at http://python-logstash-async.readthedocs.io/en/latest/.

Installation

The easiest method is to install directly from pypi using pip:

pip install python-logstash-async

If you prefer, you can download python-logstash-async and install it directly from source:

python setup.py install

Get the Source

The source code is available at https://github.com/eht16/python-logstash-async/.