ServerLogStream-Merger is a Python-based utility designed to automate the merging of multiple server log files into a single, chronologically ordered log file using the merge sort algorithm. It’s ideal for system administrators, developers, and anyone managing multiple server log streams.
- Merges multiple
.logfiles from a selected input folder - Sorts log entries based on timestamps
- Outputs a single merged
.logfile to a specified output folder - Simple command-line interface (CLI) for easy integration
- Input Folder: Contains raw
.logfiles with server logs. - Parsing: Each log file is read, and timestamped lines are extracted.
- Merging: A merge sort algorithm combines logs into a single, sorted list based on timestamps.
- Output File: The merged logs are written into one clean
.logfile.
- Python 3.7+
- No external dependencies required
- Interactive
- command line
- Run the program
python log_merger.py- You'll be prompted to:
- Enter the path to the folder containing your .log files (eg. ./logs)
- Enter the path where the merged file should be saved (eg. ./output)
- Run the program
python log_merger.py [--input_folder INPUT_FOLDER] [--output_folder OUTPUT_FOLDER]mergeSortProject/
├── server1.log
├── server2.log
├── server3.log
├── log_merger.pyEach log line should begin with a timestamp
2023-07-17 12:00:01 Server started.
2023-07-17 12:01:45 Connection established.After execution, the merged logs will be saved to the ouput folder you specify:
MergedLog_2025-07-17_14-30-00.log-
Only supports logs with timestamped lines in standard YYYY-MM-DD HH:MM:SS format.
-
Does not yet support:
-
JSON or XML log formats
-
Duplicate filtering
-
Timestamp format auto-detection
-
GUI mode
-
Add support for multiple timestamp formats
-
Duplicate entry removal
-
File type filtering (e.g., .log, .txt)
-
GUI for easier interaction
-
Real-time log merging from multiple servers
-
Unit tests and CI pipeline
Want to contribute? Fork this repo and create a pull request! Or open an issue with suggestions or bug reports.
This project is open source and free to use under the MIT License.
Abraham K.C. Blam.
Email: abrahamblama19@gmail.com
GitHub: @KCblama19
If you found this project helpful, consider giving it a ⭐ on GitHub or sharing it with others!