1. Introduction
This lightweight tool fetches MySQL binlog details (size, start/end time, duration) without direct server access.
Use Cases:
- Cloud Environments – Inspect binlogs when server login is restricted.
- Replication Delays – Check binlog growth or write patterns.
- PITR (Point-in-Time Recovery) – Locate binlogs by operation timestamps.
2. Tool Demo
Command:
./mysql-binlog-time-extractor -h 10.0.0.108 -P 3306 -u root -p 123456
Output:
+------------+-----------+---------------------+---------------------+----------+------+
| Log_name | File_size | Start_time | End_time | Duration | GTID |
+------------+-----------+---------------------+---------------------+----------+------+
| mysql-bin.000046 | 805 bytes | 2025-06-22 11:09:38 | 2025-06-24 10:33:59 | 47:24:21 | 503-504 |
| mysql-bin.000047 | 11.82 KB | 2025-06-24 10:33:59 | 2025-07-05 00:02:27 | 253:28:28 | 505-517 |
| ... | ... | ... | ... | ... | ... |
+------------+-----------+---------------------+---------------------+----------+------+
3. Download & Installation
GitHub: https://github.com/slowtech/mysql-binlog-time-extractor
Binary (Linux AMD64):
wget https://github.com/slowtech/mysql-binlog-time-extractor/releases/download/v1.0.0/mysql-binlog-time-extractor-linux-amd64.tar.gz
tar xvf mysql-binlog-time-extractor-linux-amd64.tar.gz
Source Code (Go Required):
wget https://github.com/slowtech/mysql-binlog-time-extractor/archive/refs/tags/v1.0.0.tar.gz
tar xvf v1.0.0.tar.gz
cd mysql-binlog-time-extractor-1.0.0/
go build
4. Parameters
./mysql-binlog-time-extractor --help

Example (Higher Concurrency):
./mysql-binlog-time-extractor -h 10.0.0.108 -P 3306 -u root -p 123456 -n 10
5. How It Works
- Fetch Binlog List: Executes
SHOW BINARY LOGS
to get file names/sizes. - "Pretend" as Secondary: Analyzes only the first two events per binlog:
FORMAT_DESCRIPTION_EVENT
→ Binlog creation time.PREVIOUS_GTIDS_EVENT
→ GTID history.
- End Time Calculation: Uses the next binlog’s start time for efficiency.
6. Notes
- Ignore This Error
[error] binlogstreamer.go:78 close sync with err: sync is been closing...
- (Harmless, from
go-mysql
library.) - Compatibility: MySQL 5.7+ (requires GTID support).
7. Conclusion
✅ No Server Login Needed – Cloud-friendly.
✅ Fast & Lightweight – Minimal performance impact.
✅ PITR & Replication Debugging – Essential for DBAs.
Perfect for:
- Cloud DB monitoring
- Replication troubleshooting
- Backup validation