Skip to main content

Get lines from a number of log files with different time-stamp formats in chronological order

Project description

Mingle is a library and command line tool to allow you to read from many log files, line by line in chronological order.

Introduction

Mingle uses the python-dateutil module to flexibly attempt to parse the first part of each line as a datetime, and provides a generator to access the lines in total chronological order, across the input files.

It also offers a function to conveniently print the lines out in chronological order, optionally marking which files the lines come from.

A command line utility ‘mingle’ is also provided, to print the log file lines in chronological order from the shell.

Usage:

To access a generator that will return lines from multiple log files in chronological order:

>>> from mingle import mingled
>>> files = ['webserver-log', 'db-log', 'firewall-log']
>>> for line, filename in mingled(files):
>>>     print("The line: " + line)
>>>     print("From file:" + filename)

To conveniently print the lines to stdout:

>>> import mingle
>>> files = ['webserver-log', 'db-log', 'firewall-log']
>>> mingle.cat(files)

To print the usage of the command line interface:

user@localhost:~$ mingle -h
usage: mingle [-h] [-q] files [files ...]

Inter-mingle the contents of several log files by date stamp.

positional arguments:
  files        the files to intermingle

optional arguments:
  -h, --help   show this help message and exit
  -q, --quiet  strip the filename annotations from the output

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

mingle-0.1.7.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file mingle-0.1.7.tar.gz.

File metadata

  • Download URL: mingle-0.1.7.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mingle-0.1.7.tar.gz
Algorithm Hash digest
SHA256 f32def32fda9c9912018aa225835824517f16946ef5f5ff81f1dabc4db5864ab
MD5 a4d8e6cf721182d564e6eb0122f9ed72
BLAKE2b-256 770503d3a53adf6262c956b39cb5f44994020c949ccda2b13fd2522efad33aa0

See more details on using hashes here.

Supported by

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