graypy
Python logging handlers that send messages in the Graylog Extended Log Format (GELF).
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 graypyuv
uv add graypypoetry
poetry add graypyInstalling 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
Tags
More Logging packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
python-json-loggerFormats Python logging output as JSON, making…
permissive · top 1,000 on PyPI
structlogstructlog is a structured logging library that…
permissive · top 1,000 on PyPI
loguruLoguru provides a pre-configured logger that…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
wandbwandb is a machine learning experiment tracking…
permissive · top 1,000 on PyPI
pygelfProvides Python logging handlers that send log…
permissive · top 15,000 on PyPI
python3-logstashA Python logging handler that forwards log…
permissive · top 15,000 on PyPI
python-logstashSends Python log records to Logstash over UDP…
permissive · top 15,000 on PyPI
libadvianProvides a collection of small utility helpers…
permissive · top 15,000 on PyPI
logtail-pythonA Python client library for sending structured…
permissive · top 5,000 on PyPI
google-cloud-appengine-loggingClient library for Google Cloud AppEngine…
permissive · top 1,000 on PyPI
logzio-python-handlerA Python logging handler that sends logs in…
permissive · top 5,000 on PyPI
google-cloud-loggingWrites log entries to Google Cloud Logging and…
permissive · top 1,000 on PyPI
lib-log-richProvides Rich-styled colored console logging…
permissive · top 15,000 on PyPI
cloudwatchA Python logging handler that sends log events…
permissive · top 15,000 on PyPI