Async UDP client for sending GELF messages to Graylog
Project description
Async GELF Client
Async UDP client for sending GELF messages to Graylog. Uses native asyncio for maximum performance and automatically compresses messages larger than 8KB.
Installation
pip install async-gelf-client
Usage
import asyncio
from async_gelf_client import AsyncGelfUdpClient, create_gelf_message
async def main():
client = AsyncGelfUdpClient(host="localhost", port=12201)
message = create_gelf_message(
short_message="Hello Graylog",
level=6,
host="myapp"
)
await client.send(message)
asyncio.run(main())
API
AsyncGelfUdpClient
Async UDP client for sending GELF messages.
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
create_gelf_message
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
convert_python_log_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file async_gelf_client-0.1.0.tar.gz.
File metadata
- Download URL: async_gelf_client-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0de1767ebf433b0187e4a0f29665b3ac7b37f453434c9fec1d6bc3b5893a7b1e
|
|
| MD5 |
f921bfcb24a09ee41ed323393c736277
|
|
| BLAKE2b-256 |
4ddfb625c59226bd38ecf9d02e242375a8fa5709e0b10d2e9503f6f095759cdf
|
File details
Details for the file async_gelf_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: async_gelf_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f30b52f12ec3ccd84182ce5d5f231f58988b36240dfd385f50169baab856454
|
|
| MD5 |
95a5840d571b7d16e87d14bc695900f7
|
|
| BLAKE2b-256 |
71895f1a8efccbdbcb93d5130bcad463b53e773dc3d40781cd684ca059a9a244
|