Skip to content

Instantly share code, notes, and snippets.

View pmeulen's full-sized avatar

Pieter van der Meulen pmeulen

View GitHub Profile
@pmeulen
pmeulen / split_log.py
Last active May 14, 2025 11:15
Split a log file into multiple files based on the date at the start at each line. For that time when logrotate did not run...
#!/usr/bin/env python3
"""
Split a log file into multiple files based on the dates at the start at each line.
For that time when logrotate did not run...
See the help text for more information on using this script.
Limitations:
- The date must be at the start of each line must have a fixed length. This could be made more flexible by e.g. allowing
the user to provide a regex to match the date.