Skip to content

A python logging bundle to send logs using GELF

Notifications You must be signed in to change notification settings

cdumay/logging-gelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logging GELF

Latest version Documentation Status

A python logging bundle to send logs using GELF. This is a rewrote of Djehouty

Quickstart

First, install logging-gelf using pip:

pip install -U logging-gelf

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(schema=MyGelfSchema, null_character=True))
logger.addHandler(handler)
logger.debug("hello !")

Documentation

Logging adapter, extra, custom schema and many other stuff are available in the full documentation available at http://logging-gelf.readthedocs.io/ .

Requirements

  • Python >= 3.3

Project Links

License

Apache License 2.0

About

A python logging bundle to send logs using GELF

Resources

Stars

Watchers

Forks

Packages

No packages published