gelfclient
Python client for sending UDP messages in Graylog Extended Log Format (GELF).
Messages are zlib compressed, and support GELF chunked encoding.
Since messages are sent with UDP, the log method should return quickly and not raise an exception due to timeout. However an exception may be raised due to a DNS name resolution failure for the target hostname.
Installation
pip install gelfclient
Usage
from gelfclient import UdpClient
gelf_server = 'localhost'
# Using mandatory arguments
gelf = UdpClient(gelf_server)
# Using all arguments
gelf = UdpClient(gelf_server, port=12202, mtu=8000, source='macbook.local')
# Bare minimum is to send a string, which will map to gelf['short_message']
gelf.log('server is DOWN')
# 'source' and 'host' are the same. Defaults to socket.gethostname() but can be overridden
gelf.log('server is DOWN', source='hostchecker')
# Set extra fields
gelf.log('status change', _state='DOWN', _server='macbook')
# Set severity level
import syslog
gelf.log('unexpected error', level=syslog.LOG_CRIT)
# You can also prepare all data into a dictionary and give that to .log
data = {}
data['short_message'] = 'warning from python'
data['host'] = 'hostchecker'
data['level'] = syslog.LOG_WARNING
gelf.log(data)
See the GELF specification for other fields and their meaning: http://docs.graylog.org/en/latest/pages/gelf.html#gelf-format-specification
Metadata
Release files for gelfclient 0.0.7
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 | Actions |
|---|---|---|---|---|
| gelfclient-0.0.7.tar.gz | 6.9 kB | Without provenance | Details for gelfclient-0.0.7.tar.gz |
Release files / gelfclient-0.0.7.tar.gz
| Download URL | gelfclient-0.0.7.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ace3d5718a5e844145090a5d31ed05c5fb7edd4057d00366038d8ebe6247178e
|
|
BLAKE2b-256 checksum How to use checksums |
a02d777339ff87624bfb014fd4f28e324d572a612a2291d53d797702e971b83d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for gelfclient 0.0.7
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.