Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dblogger

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dblogger

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

  • 0.4.14
  • PyPI
  • Socket score

Maintainers
2

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc