Skip to main content

DB-backed python logging.Handler subclass that uses kvlayer, and provides command-line tools.

Project description

dblogger
========

Provides two capabilities:

1) a subclass of python logging.Handler that stores logs using kvlayer

2) command line tools for searching through logs stored in kvlayer



Format
======

Logs are stored in kvlayer using the following format:

:key: UUID generated from the created field of the LogRecord class.
:value: JSON object with the LogRecord attributes except args and msg.

For more information have a look at Python LogRecord documentation.
http://docs.python.org/2/library/logging.html#logrecord-attributes


Usage
=====

Python
------

This is a small app in Python, an example of how to use dblogger.

import yaml
import logging
import kvlayer
from dblogger import DatabaseLogHandler, DBLoggerQuery

config = yaml.load(open("/myapp/config.yaml"))
client = kvlayer.client(config)
namespace = "myapp"

logger = logging.getLogger('mymodule')
logger.setLevel(logging.DEBUG)
dbhandler = DatabaseLogHandler(client, namespace)
logger.addHandler(dbhandler)

logger.warn("this is a demo msg")



Command Line
------------

After installing the python package, this command line entry point
will be available:

dblogger -c myconfig.yaml appname namespace loglevel filter

:filter: could be a regex to be applied to the log message or a field=regex pair,
specifying the log record field and the regex to be applied to that field.


Testing
=======

make test

Building
========

To build the module:

make

To create an egg package:

make build_egg

To create RPM packages:

make build_rpm

If you want to publish the package:

make register

and to clean everything:

make clean


TODO
====

- test rpm packge in a RPM platform.
- search from command line.
- 'tail -f' behavior for the log search interface.

Project details


Download files

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

Source Distribution

dblogger-0.4.12.dev1.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dblogger-0.4.12.dev1-py2.7.egg (33.0 kB view details)

Uploaded Egg

File details

Details for the file dblogger-0.4.12.dev1.tar.gz.

File metadata

File hashes

Hashes for dblogger-0.4.12.dev1.tar.gz
Algorithm Hash digest
SHA256 4ccc036bcc671f56bbee9aefc310b1dccd6132f90f7a80baa961c6e68794996e
MD5 6b565d396dd055fa3def039eeb81e824
BLAKE2b-256 6eba0ca42c5ed57a37ddb4b578f10c5bf275352c0eaeb5aac048d1ab66108c61

See more details on using hashes here.

File details

Details for the file dblogger-0.4.12.dev1-py2.7.egg.

File metadata

File hashes

Hashes for dblogger-0.4.12.dev1-py2.7.egg
Algorithm Hash digest
SHA256 bf18e02e8eb618e17ee976cc74bbfbd5c286dcfbb72b2ea3708ebf8ce5200f02
MD5 005e8f4caa86dde02a0de41830db62a8
BLAKE2b-256 41a88ec617655b96851949ae413b409de2ed5db2ab4b415f3d4b0cca3b3a106b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page