Skip to main content

Lightweight logstash_formatter logging initializer

Project description

https://travis-ci.org/graphiq-data/GIQLogging.svg?branch=master https://badge.fury.io/py/giqlogging.svg

GIQLogging is a lightweight logging initializer to promote standardized log formats across services. It wraps the functionality of logging with formatting provided by Exoscale’s python-logstash-formatter.

import GIQLogging
logging = GIQLogging.init(logstash_type='servicename',
                          level=GIQLogging.INFO,
                          logpath='/path/to/log/output',
                          logger_name='servicename',
                          extra_fields={'foo': 'bar', 'hello': 'world'})
logging.info('log message')

Installation

To install GIQLogging, simply:

pip install GIQLogging

Assumptions

  • In Graphiq’s case, GIQLogging is specifically intended for services to log JSON output to be picked up and visualized using an ELK (Elasticsearch, Logstash & Kibana) stack. As such, we require the logstash_type value to be set upon initialization. This value is placed as an extra_field and output to each log entry for later use by Logstash.
  • The default level if one is not provided is logging.DEBUG
  • If a logpath is not provided the log will be directed to sys.stdout
  • logger_name is optional, only necessary if initializing multiple loggers
  • extra_fields are optional

Issues

Please submit issues here.

Project details


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
GIQLogging-1.0.4.tar.gz (3.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

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