Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

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.


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.


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']

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

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(3.7 kB) Copy SHA256 Hash SHA256
Source Nov 25, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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