Splitting logs by date

loglab only includes one consumer of logs, a utility class that reads log lines from some source (possibly an ordered, merged, converted chain of filters, adapters and so on) and saves them to files, each file named with a specific date.

class loglab.date_splitter.LogSplitter(out_template)[source]

Date-based splitting and compressing of logs.

LogSplitter will read all input lines and write each lines to a file named according to out_template, which should be in the format of Python’s strftime.

This will overwrite any logs files that already exist.

If out_template ends with ‘.gz’ the logs will be gzip-compressed.

split(lines)[source]

Split a sequence of lines among log files by date.

This should only be called once; subsequent calls may overwrite files.

Previous topic

Utility Classes

This Page