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.
========
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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dblogger-0.4.12.dev1-py2.7.egg
(33.0 kB
view details)
File details
Details for the file dblogger-0.4.12.dev1.tar.gz.
File metadata
- Download URL: dblogger-0.4.12.dev1.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ccc036bcc671f56bbee9aefc310b1dccd6132f90f7a80baa961c6e68794996e
|
|
| MD5 |
6b565d396dd055fa3def039eeb81e824
|
|
| BLAKE2b-256 |
6eba0ca42c5ed57a37ddb4b578f10c5bf275352c0eaeb5aac048d1ab66108c61
|
File details
Details for the file dblogger-0.4.12.dev1-py2.7.egg.
File metadata
- Download URL: dblogger-0.4.12.dev1-py2.7.egg
- Upload date:
- Size: 33.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf18e02e8eb618e17ee976cc74bbfbd5c286dcfbb72b2ea3708ebf8ce5200f02
|
|
| MD5 |
005e8f4caa86dde02a0de41830db62a8
|
|
| BLAKE2b-256 |
41a88ec617655b96851949ae413b409de2ed5db2ab4b415f3d4b0cca3b3a106b
|