Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.1 KB

index.rst

File metadata and controls

44 lines (29 loc) · 1.1 KB

logging-gelf

A python 3 logging bundle to send logs in Graylog Extended Log Format (GELF) . This is a rewrite 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 !")

Get It Now

First, install logging-gelf using pip:

pip install -U logging-gelf

Documentation content

api_focus.rst guides.rst