graypy is a Python library that provides logging handlers for sending messages in the Graylog Extended Log Format (GELF). It integrates with Python's standard `logging` module and supports various transport protocols including UDP, TCP, TLS, HTTP, and RabbitMQ. The current version is 2.1.0, and while there isn't a strict release cadence, major versions have introduced breaking changes.
pip install graypyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure a basic UDP logging handler (`GELFUDPHandler`) to send messages to a Graylog server. It uses environment variables for the Graylog host and port, which is a common practice for configuration management. Ensure your Graylog server has a GELF UDP input configured on the specified port.
Replace `GELFHandler` with `GELFUDPHandler` and `GELFTcpHandler` with `GELFTCPHandler` or `GELFTLSHandler` based on your protocol requirements.
For high-priority or critical logs, consider using `GELFTCPHandler`, `GELFTLSHandler`, or `GELFRabbitHandler` and configure a corresponding input on your Graylog server.
Refer to `graypy` documentation and RabbitMQ configuration guides for proper setup of queues and exchanges for AMQP-based GELF logging.
Monitor the GitHub repository issues and commits for updates, or pin `graypy` to a specific version to avoid unexpected changes.
Verify container networking configurations, ensuring proper hostname resolution or direct IP addressing between your application and Graylog instances.
Install `graypy` with the AMQP extra: `pip install graypy[amqp]`
Replace `GELFHandler` with the appropriate specific handler, such as `graypy.GELFUDPHandler` or `graypy.GELFTCPHandler`, depending on your Graylog input configuration.
Increase the `chunk_size` parameter in your `graypy` handler's constructor, or configure a different chunking strategy (e.g., `GELFTruncatingChunker` for `GELFUDPHandler`) to allow for larger messages or truncation instead of dropping.
No dependency data recorded yet.