Skip to main content

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 loggly.com.

Installation

Install dependencies

py2loggly only depends on gevent

Install py2loggly

From sources

$ python setup.py install

From Pypi

$ pip install py2loggly

Usage

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.

Parameters

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.

Example

import logging, logging.handlers

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

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

License

MIT

Release files for py2loggly 1.1.2

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

Source distribution (sdist)

Source distribution for py2loggly 1.1.2
File Size Uploaded
py2loggly-1.1.2.tar.gz 5.4 kB Details

Release files / py2loggly-1.1.2.tar.gz

Download URL py2loggly-1.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3764ad0931decea9939e54e4c494a1831ae3b305fa8a27f69068b8e88c1824eb
BLAKE2b-256 checksum
How to use checksums
e29c7c8028ab6521bb21dd32d7f27e5218b6feb0aaf02621d110ce38e369e708
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.2 This release

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

0.2

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