Skip to main content

Log handler that ships json formatted messages to logstash via TCP and UDP

Project description

logstashHandler is a basic logging handler for sending to a logstash instance via UDP or TCP encoded as json.

Basic usage

Setup an input on the relevant logstash server:

input {
  udp {
    port => 12345
    codec => json

Setup handler and ship logs:

from logstashHandler import logstashHandler

lhandler = logstashHandler(host='',port=12345,proto='UDP')
logger.warn("Something went wrong")

To send additional fields to logstash, use the keyword extra and send a dict starting with extraFields:

logger.warn('DANGER DANGER',extra={'extraFields':{'name':'W. Robinsson', 'planet':'Unkown'}})

The default level field name and individual level names can be overridden as so:

levels = {'ERROR': 3, 'WARNING': 2, 'INFO': 1, 'DEBUG': 0}
lhandler = logstashHandler(

More info can be found on the github page.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for logstashHandler, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size logstashHandler-0.1.4.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page