Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A proxy for python UDP/TCP logging to loggly

Project description

Py2Loggly is a proxy server listening on UDP and TCP for messages coming from python’s UDP/TCP logging handler, it will forward all these messages to


Install dependencies

py2loggly only depends on gevent

Install py2loggly

From sources

$ python install

From Pypi

$ pip install py2loggly


Starting the server

The only required parameter is --loggly-token to provide your loggly TOKEN.

$ py2loggly --loggly-token $LOGGLY_TOKEN

The default TCP port is 9020 and the default UDP port is 9021.


usage: py2loggly [-h] [-v] [--bind-ip IP] [--tcp-port PORT] [--udp-port PORT]
                 [--fqdn] [--hostname HOSTNAME] --loggly-token TOKEN
                 [--tags TAG1 TAG2 [TAG1 TAG2 ...]]

Proxy for python UDP/TCP logging to loggly

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  --bind-ip IP          IP address to listen on
  --tcp-port PORT       TCP port to listen on
  --udp-port PORT       UDP port to listen on
  --fqdn                Use the fully qualified domain name
  --hostname HOSTNAME   Use the provided hostname instead of guessing it.
  --loggly-token TOKEN  the loggly TOKEN.
  --tags TAG1 TAG2 [TAG1 TAG2 ...]
                        Tags for the event message

Sending messages to py2loggly

You can either use SockerHandler or DatagramHandler from python’s logging.handlers

The biggest advantage to use DatagramHandler is that logging won’t slow down your application and if py2loggly is not running, it won’t impact your application.

So the recommended setup is to run py2loggly locally on each server and use the DatadgramHandler.


import logging, logging.handlers

rootLogger = logging.getLogger('')
socketHandler = logging.handlers.SocketHandler('localhost',
# don't bother with a formatter, since a socket handler sends the event as
# an unformatted pickle

# Now, we can log to the root logger, or any other logger. First the root...'Jackdaws love my big sphinx of quartz.')



Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
py2loggly-1.1.2.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None Sep 22, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page