skillfed

graypy

Python logging handlers that send messages in the Graylog Extended Log Format (GELF).

graypy v2.1.0 561.5K downloads/30d#5,994 on PyPI265
Permissive license BSD License DORMANT released

What it is and what it does

graypy is a Python logging handler library that bridges the standard logging module to Graylog servers by formatting log records in GELF and forwarding them over the network. It provides five handler classes—GELFUDPHandler, GELFTCPHandler, GELFTLSHandler, GELFHTTPHandler, and GELFRabbitHandler—each supporting a different transport mechanism. The library automatically includes debugging fields (function name, process ID, thread name) in logs and supports custom fields via LoggerAdapter or Filter classes. It also handles exception tracebacks and GELF UDP message chunking with configurable overflow behavior.

The package has no runtime dependencies for basic UDP/TCP/HTTP use, making it lightweight to install. Optional AMQP support for RabbitMQ-based log forwarding requires the amqp extra. However, the project is dormant—the last release was in September 2019 and the last repository commit in October 2023—so it receives no active maintenance and may not work reliably with recent Graylog or Python versions.

Use it for:

  • Forward application logs from a Python service to a centralized Graylog server for aggregation and analysis.
  • Integrate Django application logging with Graylog by configuring GELFUDPHandler in Django's logging dictConfig.
  • Send logs via RabbitMQ instead of UDP to avoid packet loss in high-volume logging scenarios.
  • Add custom contextual fields (user ID, request ID, etc.) to logs using LoggerAdapter before forwarding to Graylog.
  • Capture and forward exception tracebacks to Graylog as full_message fields for debugging.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python logging handlers that format and send log messages to Graylog servers in GELF (Graylog Extended Log Format) via UDP, TCP, TLS, HTTP, or RabbitMQ.

Yes, if you have a stable, older Graylog deployment and do not need active maintenance. The package is simple, dependency-free for basic use, and permissively licensed. No, if you require support for recent Python versions, current Graylog API changes, or active bug fixes—the dormant status since 2019 means you are on your own for compatibility issues.

Install

graypy on PyPI

pip

pip install graypy

uv

uv add graypy

poetry

poetry add graypy

Installing graypy

Before you install

Low install friction with no runtime dependencies for basic use. Package is dormant—last release was 2019-09-30 and last commit 2023-10-24—so expect no active maintenance or updates for newer Python versions or Graylog API changes.

License in practice

BSD License (permissive) allows use in most projects without significant restriction, though you should review the full license text for your specific use case.

Quickstart

pip install graypy

import logging
import graypy

my_logger = logging.getLogger('test_logger')
my_logger.setLevel(logging.DEBUG)
handler = graypy.GELFUDPHandler('localhost', 12201)
my_logger.addHandler(handler)
my_logger.debug('Hello Graylog.')

Requires a Graylog server running and accessible at the specified host and port; RabbitMQ handler requires amqp extra and a configured RabbitMQ instance.

Verify before relying

  • Whether the package works reliably with current Graylog versions (3.x and later) given the long dormancy since 2019.
  • Compatibility with Python versions released after 2019 (classifiers only list up to 3.7).
  • Whether UDP packet loss handling and chunking behavior meet production requirements.

Package facts

License BSD License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 2,510 days since the last release
Last repo commit
First released
Downloads 561,493/month — #5,994 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: graypy-2.1.0-py2.py3-none-any.whl

Keywords: logging, gelf, graylog2, graylog, udp, amqp

Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: System :: Logging

Tags

graylog logging handlergelf log format pythonsend logs to graylogpython graylog integrationgelf udp tcp handlercentralized log forwardinggraylog2 graylog3 client
graylog-integrationcentralized-logging

More Logging packages