A python 3 logging bundle to send logs in Graylog Extended Lenght Format (GELF) . This is a rewrote of Djehouty.
The following example shows how to send log in Graylog TCP input
import logging
from logging_gelf.formatters import GELFFormatter
from logging_gelf.handlers import GELFTCPSocketHandler
logger = logging.getLogger("gelf")
logger.setLevel(logging.DEBUG)
handler = GELFTCPSocketHandler(host="127.0.0.1", port=12201)
handler.setFormatter(GELFFormatter(null_character=True))
logger.addHandler(handler)
logger.debug("hello !")
First, install logging-gelf using pip:
pip install -U logging-gelf
.. toctree:: :maxdepth: 1 api_focus.rst guides.rst