Skip to main content
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 larrabee-gelfclient 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for larrabee-gelfclient 0.0.6
File Size Uploaded
larrabee-gelfclient-0.0.6.tar.gz 6.9 kB Details

Release files / larrabee-gelfclient-0.0.6.tar.gz

Download URL larrabee-gelfclient-0.0.6.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6a9cf40a1b260908cf4275a0e19e2c74830b52287a52c3b103140ca2e40e7ebf
BLAKE2b-256 checksum
How to use checksums
336193840ad32df28f617f5b27d34c56865c71269cd456fa96a8d8326ace4f8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.6 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page