Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install logmongo

How to install logmongo

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install logmongo
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.0.3
0.1.4Never BuiltWhy not?
0.0.3 Available View build log
Linux (64-bit)
0.1.4 Available View build log
0.0.3 Available View build log
 
License
Public Domain
Dependencies
Imports
Lastest release
version 0.1.4 on Jan 9th, 2014

Installation

pip install logmongo
easy_install logmongo

What does it do?

  • Gracefully creates capped collections.
  • Auto expires oldest records first and solves log rotation.
  • Writes complex (dicts and kwargs) log records.
  • Logs asynchronously.
  • Collects logs locally or remotely or in a central location.
  • Allows access to logs via MongoDB queries and APIs.
  • Logs newline separated STDIN JSON strings to MongoDB

Why should I use Logmongo instead of just pymongo?

Logmongo subclasses the pymongo Collection object and provides the following additions -

By default a new Logmongo object will create a 512M named capped collection

write method which:

  • logs all passed keywords
  • if 'when' is not in record, add 'when' timestamp to log record
  • if 'source' is not in record, add 'source' add FQDN to log record

query method which:

  • allows keywords (kwargs) querying for example:

    log.query( tags='finance' )
    

tail method which:

  • prints all records to standard out which match the given query until killed

How does it work?

Example:

from logmongo import Logmongo

log = Logmongo('logs')

log.write( message='No required kwargs or fields!' )

entry = {
  'tags':['but','we','like','tags'],
  'level':'info'
}
log.write( entry )

# for more help check out
help( logmongo )

STDIN JSON to MongoDB

Example:

# tail the log collection
./logmongo --tail

# in another shell echo a JSON string into logmongo
echo '{"test":[143,435,432]}' | ./logmongo

# for more information
./logmongo --help

License

Public Domain

How do I thank you?

Write me an email! I always respond back!

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.