Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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:

python
from logstashHandler import logstashHandler

lhandler = logstashHandler(host='mylogserver.example.com',port=12345,proto='UDP')
logger.addHandler(lhandler)
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(
    host='mylogserver.example.com',
    port=12345,
    proto='UDP',
    levels=levels,
    levelLabel='severity'
)

More info can be found on the github page.

Release History

Release History

This version
History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
logstashHandler-0.1.4.tar.gz (2.3 kB) Copy SHA256 Checksum SHA256 Source Sep 24, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting