Async GELF Client
Fully async UDP client for sending GELF messages to Graylog. Uses native asyncio for maximum performance, automatically compresses messages larger than 8KB, and runs all blocking operations in thread pool to avoid blocking the event loop.
Installation
pip install async-gelf-client
Usage
import asyncio
from asyncgelf import AsyncGelfClient, GelfMessage
async def main():
client = AsyncGelfClient(host="localhost", port=12201)
message = GelfMessage.create(
short_message="Hello Graylog",
level=6,
host="myapp"
)
await client.send(message)
asyncio.run(main())
Parallel sending (high performance)
import asyncio
from asyncgelf import AsyncGelfClient, GelfMessage
async def main():
client = AsyncGelfClient(host="localhost", port=12201)
# Send multiple messages in parallel without blocking
messages = [
GelfMessage.create(short_message=f"Message {i}", level=6, host="myapp")
for i in range(100)
]
await asyncio.gather(*[client.send(msg) for msg in messages])
asyncio.run(main())
API
AsyncGelfClient
Fully async UDP client for sending GELF messages. All blocking operations (JSON serialization, gzip compression) run in thread pool.
Parameters:
host(str): Graylog server hostname or IP addressport(int): UDP port (default: 12201)compress_threshold(int): Message size in bytes to trigger compression (default: 8192)
Methods:
async send(message: dict[str, Any]) -> None: Sends GELF message
GelfMessage
GELF message builder with static methods.
Methods:
GelfMessage.create(...)
Creates a properly formatted GELF message.
Parameters:
short_message(str): Short log description (required)full_message(str | None): Full log description (optional)level(int): Syslog level (7=debug, 6=info, 4=warning, 3=error, 2=critical)host(str): Host/application nametimestamp(float | None): Unix timestamp (if None - current time)**additional_fields: Additional fields (will be prefixed with _)
Returns: dict with GELF message
GelfMessage.convert_log_level(python_level)
Converts Python logging level to Syslog level for GELF.
Parameters:
python_level(int): Python logging level (logging.DEBUG, logging.INFO, etc.)
Returns: int - Syslog level
Requirements
- Python >= 3.10
License
MIT
Metadata
Release files for async-gelf-client 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_gelf_client-0.2.1.tar.gz | 4.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_gelf_client-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / async_gelf_client-0.2.1.tar.gz
| Download URL | async_gelf_client-0.2.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33b7cd6e2a6fb621658fe55d3b6d01e4f0f51742fa797572c0a4bb4692b01c92
|
|
BLAKE2b-256 checksum How to use checksums |
6a6199ffa1d6b478a833cbb428f3b125ca3e33f581365b3a150ab3fddb8cc3cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / async_gelf_client-0.2.1-py3-none-any.whl
| Download URL | async_gelf_client-0.2.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d33b7ac4fa2168d7a7648f1a3fbbcc5d7a8ba6ce34518a877c8d105411604ed0
|
|
BLAKE2b-256 checksum How to use checksums |
1d4538e8b88b28d5ff683badac51919bb84f057aa3441f2709bc4265238b7d39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for async-gelf-client 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.