Skip to content

A library to analyse and split log files into smaller subfiles containing log entries for specific year(s) and month(s)

Notifications You must be signed in to change notification settings

RZarifov/log-divisor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Log divisor

Description:
A library for analyzing and splitting the large log file into smaller, manageable chunks, for respective year, month, day.

Dependencies:
None

Usage:

from log_divisor import LogDivisor as LD
ld = LD("path_to_log/file.log")
ld.divide_log_file("path_to_save_the_split_logs") # argument is optional.
# By default it outputs the split files next to the processed log file.

Supported formats:
The default, and only format for this version is '%Y-%m-%d %H:%M:%S'
If the user wants to process the log file in different format, he should instance the DATE_FORMAT, by providing both time format and the regex format. The arguments for the instance are: time_strp and date_regex respectively.
The default representation of both is:

date_regex = r'(\d+-\d+-\d+ \d+:\d+:\d+)',
time_strp = '%Y-%m-%d %H:%M:%S'

Possible future enhancement: Guessing the regex format from the time_strp format, freeing the user from the necessity to provide one.

TODOs:

  • TODO: Get rid of the custom regex format, deduce it from the time format
  • TODO: Support async code and operations
  • TODO: Multiple formats support out of the box
  • TODO: pypi release

About

A library to analyse and split log files into smaller subfiles containing log entries for specific year(s) and month(s)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages