A configurable tool to parse arbitrary instrument log files into a structured CSV, using a user-defined state machine.
- Configuration-driven: all paths, regex patterns, event sequence, and CSV columns live in
config.json. - Flexible state machine: default three steps (
init→config→execute), but you can rename or add stages. - Automatic encoding detection (via chardet).
- Recursive file discovery, natural sort, and optional bulk rename.
- Robust error handling and detailed logging (
log_processor.log). - Easy to extend, test, and maintain.
# clone this repo
git clone https://github.com/your-username/instrument-log-processor.git
cd instrument-log-processor
# (optional) create and activate a virtualenv
python3 -m venv .venv
source .venv/bin/activate
# install dependencies
pip install -r requirements.txt-
Edit
config.jsonto point to your log folder, define event regexes, sequence, and desired CSV columns. -
Run:
python3 processor.py --config config.json
-
The CSV will be written to the path in
config.json(or override with-o output.csv).
See config.json for a fully-commented example. Key sections:
FOLDER_PATH/OUTPUT_CSV– input/output pathsEVENT_SEQUENCE– ordered list of your event stagesPATTERN_CONFIG– regex patterns for each stageCSV_FIELDS– final CSV column order
pytestThis project is derived in part from internal company logic. It was developed outside of company time and equipment, and does not disclose any confidential or proprietary information. Use at your own risk; the author disclaims any liability for misuse.