[Tutor] Logfile multiplexing

Stephen Nelson-Smith sanelson at gmail.com
Wed Nov 11 10:46:24 CET 2009


Hi Kent,

> See the Python Cookbook recipes I referenced earlier.
> http://code.activestate.com/recipes/491285/
> http://code.activestate.com/recipes/535160/
>
> Note they won't fix up the jumbled ordering of your files but I don't
> think they will break from it either...

That's exactly the problem.  I do need the end product to be in order.
 The problem is that on my current design I'm still getting stuff out
of sync.  What I do at present is this:

Each of these columns is a log file (logfile A, B C D), with a number
of entries, slightly out of order.

1      1      1      1
2      2      2      2
3      3      3      3
A      B     C      D       ...

I currently take a slice through all (12) logs, and stick them in a
priority queue, and pop them off in order.  The problem comes that the
next slice could easily contain timestamps before the entries in  the
previous slice.  So I either need some kind of lookahead capability,
or I need to be feeding the queue one at a time, and hope the queue is
of sufficient size to cover the delta between the various logs.  It
all feels a bit brittle and wrong.

I don't really want to admit defeat and have a cron job sort the logs
before entry.  Anyone got any other ideas?

Thanks all - I'm really learning a lot.

S.


More information about the Tutor mailing list