This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
I wrote loggrok a while back as I needed a simple library

for analyzing logs. I am not actively developing loggrok, but please let me know if you find any bugs etc.

Features include:

  • Simple callback system (loggrok.actions)
  • Seemless iteration over multiple rollover-index based log files - smartly joins broken lines (RollingIndexLogStream)
  • Custom regex-based header and message body matching.

Example usage:

>>> from loggrok.actions import Action
>>> action = Action()
>>> def printError(entry):
...     print 'err!', str(entry)[:-1]
>>> action.addLevelCallback('ERROR', printError)
>>> def printWarning(entry):
...     print 'warning!', str(entry)[:-1]
>>> action.addLevelCallback('WARN', printWarning)
>>> from loggrok.log import LogStream
>>> stream = LogStream(fname)
>>> stream.action = action
>>> for entry in stream:
...     continue
err! blah blah
warning! blah blah
err! blah blah

You can also write your own regexes for matching custom headers:

>>> from loggrok.parse import HeaderParser, MessageParser
>>> header_patt = r'^([a-zA-Z]+) ([a-zA-Z]+) <(\d+)> '
# Entry attributes correspond to groups in regex pattern
>>> header_attrs = ('foo', 'bar', 'baz')
>>> header_parser = HeaderParser(header_patt, header_attrs)
>>> message_patterns = (...) # regexs for message body - after header
>>> message_attrs = (...) # tuple of attribute tuples corresponding to patters
>>> messageParser = MessageParser(message_patterns, message_attrs)
>>> stream.messageParser = messageParser

See doctest in tests directory for working examples.

To run unit tests:


N.B. - loggrok will emit warning related to “broken” CurriedCallable class, though it should not cause issues.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
loggrok-0.2.1-py2.4.egg (12.7 kB) Copy SHA256 Checksum SHA256 2.4 Egg Feb 3, 2007
loggrok-0.2.1-py2.5.egg (12.6 kB) Copy SHA256 Checksum SHA256 2.5 Egg Feb 3, 2007
loggrok-0.2.1.tar.gz (10.9 kB) Copy SHA256 Checksum SHA256 Source Feb 3, 2007

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting